diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3ad599b12c91fa233605a1f0db1a78d73235b547..771533ced6a803d23886214d5551df1f0db440b1 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -570,7 +570,7 @@ static int __cmd_record(int argc, const char **argv)
 	}
 
 	if (!system_wide && profile_cpu == -1)
-		event__synthesize_thread(pid, process_synthesized_event,
+		event__synthesize_thread(target_pid, process_synthesized_event,
 					 session);
 	else
 		event__synthesize_threads(process_synthesized_event, session);