Skip to content

Commit

Permalink
perf tools: Synthetize the targeted process
Browse files Browse the repository at this point in the history
Don't forget to also synthetize the targeted process from perf
record or we'll miss its dso in the events and then we won't be
able to deal with its build-id.

We are missing it because it is created after the existing
synthetized tasks but before the counters are enabled and can
send its mapping event.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
LKML-Reference: <1257911467-28276-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Nov 11, 2009
1 parent ca2b900 commit de89672
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,22 @@ static int __cmd_record(int argc, const char **argv)
if (target_pid == -1 && argc) {
pid = fork();
if (pid < 0)
perror("failed to fork");
die("failed to fork");

if (!pid) {
if (execvp(argv[0], (char **)argv)) {
perror(argv[0]);
exit(-1);
}
} else {
/*
* Wait a bit for the execv'ed child to appear
* and be updated in /proc
* FIXME: Do you know a less heuristical solution?
*/
usleep(1000);
event__synthesize_thread(pid,
process_synthesized_event);
}

child_pid = pid;
Expand Down

0 comments on commit de89672

Please sign in to comment.