Skip to content

Commit 373565d

Browse files
Andi Kleenacmel
authored andcommitted
perf record: Synthesize thread map and cpu map
Synthesize the per attr thread maps and cpu maps in 'perf record'. This allows code from 'perf stat' called from 'perf script' to access this information. Committer testing: Please see the PERF_RECORD_THREAD_MAP and PERF_RECORD_CPU_MAP records, added by this patch: $ perf record sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ] $ perf report -D | grep PERF_RECORD_ | head 0xe8 [0x20]: PERF_RECORD_TIME_CONV: unhandled! 0x108 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 23568 0x130 [0x18]: PERF_RECORD_CPU_MAP: 0-3 0 0x148 [0x28]: PERF_RECORD_COMM: perf:23568/23568 0x570 [0x8]: PERF_RECORD_FINISHED_ROUND 445342677837144 0x170 [0x28]: PERF_RECORD_COMM exec: sleep:23568/23568 445342677847339 0x198 [0x68]: PERF_RECORD_MMAP2 23568/23568: [0x564c943a4000(0x208000) @ 0 fd:00 3147174 2566255743]: r-xp /usr/bin/sleep 445342677862450 0x200 [0x70]: PERF_RECORD_MMAP2 23568/23568: [0x7f25968a8000(0x229000) @ 0 fd:00 3151761 2566238119]: r-xp /usr/lib64/ld-2.25.so 445342677873174 0x270 [0x60]: PERF_RECORD_MMAP2 23568/23568: [0x7ffc98176000(0x2000) @ 0 00:00 0 0]: r-xp [vdso] 445342677891928 0x2d0 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4002): 23568/23568: 0xffffffff8f84c7e7 period: 1 addr: 0 $ Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Link: http://lkml.kernel.org/r/20171117214300.32746-3-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent bfd8f72 commit 373565d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tools/perf/builtin-record.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,21 @@ static int record__synthesize(struct record *rec, bool tail)
793793
if (err)
794794
goto out;
795795

796+
err = perf_event__synthesize_thread_map2(&rec->tool, rec->evlist->threads,
797+
process_synthesized_event,
798+
NULL);
799+
if (err < 0) {
800+
pr_err("Couldn't synthesize thread map.\n");
801+
return err;
802+
}
803+
804+
err = perf_event__synthesize_cpu_map(&rec->tool, rec->evlist->cpus,
805+
process_synthesized_event, NULL);
806+
if (err < 0) {
807+
pr_err("Couldn't synthesize cpu map.\n");
808+
return err;
809+
}
810+
796811
err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
797812
process_synthesized_event, opts->sample_address,
798813
opts->proc_map_timeout, 1);

0 commit comments

Comments
 (0)