Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf thread-stack: Accumulate IPC information

Cycle and instruction counts are added to the stack. The IPC of a
function and all functions it calls, is also recorded.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190520113728.14389-14-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
003ccdc7 5db47f43

+18
+14
tools/perf/util/thread-stack.c
··· 49 49 * @timestamp: timestamp (if known) 50 50 * @ref: external reference (e.g. db_id of sample) 51 51 * @branch_count: the branch count when the entry was created 52 + * @insn_count: the instruction count when the entry was created 53 + * @cyc_count the cycle count when the entry was created 52 54 * @db_id: id used for db-export 53 55 * @cp: call path 54 56 * @no_call: a 'call' was not seen ··· 62 60 u64 timestamp; 63 61 u64 ref; 64 62 u64 branch_count; 63 + u64 insn_count; 64 + u64 cyc_count; 65 65 u64 db_id; 66 66 struct call_path *cp; 67 67 bool no_call; ··· 79 75 * @sz: current maximum stack size 80 76 * @trace_nr: current trace number 81 77 * @branch_count: running branch count 78 + * @insn_count: running instruction count 79 + * @cyc_count running cycle count 82 80 * @kernel_start: kernel start address 83 81 * @last_time: last timestamp 84 82 * @crp: call/return processor ··· 94 88 size_t sz; 95 89 u64 trace_nr; 96 90 u64 branch_count; 91 + u64 insn_count; 92 + u64 cyc_count; 97 93 u64 kernel_start; 98 94 u64 last_time; 99 95 struct call_return_processor *crp; ··· 297 289 cr.call_time = tse->timestamp; 298 290 cr.return_time = timestamp; 299 291 cr.branch_count = ts->branch_count - tse->branch_count; 292 + cr.insn_count = ts->insn_count - tse->insn_count; 293 + cr.cyc_count = ts->cyc_count - tse->cyc_count; 300 294 cr.db_id = tse->db_id; 301 295 cr.call_ref = tse->ref; 302 296 cr.return_ref = ref; ··· 554 544 tse->timestamp = timestamp; 555 545 tse->ref = ref; 556 546 tse->branch_count = ts->branch_count; 547 + tse->insn_count = ts->insn_count; 548 + tse->cyc_count = ts->cyc_count; 557 549 tse->cp = cp; 558 550 tse->no_call = no_call; 559 551 tse->trace_end = trace_end; ··· 886 874 } 887 875 888 876 ts->branch_count += 1; 877 + ts->insn_count += sample->insn_cnt; 878 + ts->cyc_count += sample->cyc_cnt; 889 879 ts->last_time = sample->time; 890 880 891 881 if (sample->flags & PERF_IP_FLAG_CALL) {
+4
tools/perf/util/thread-stack.h
··· 52 52 * @call_time: timestamp of call (if known) 53 53 * @return_time: timestamp of return (if known) 54 54 * @branch_count: number of branches seen between call and return 55 + * @insn_count: approx. number of instructions between call and return 56 + * @cyc_count: approx. number of cycles between call and return 55 57 * @call_ref: external reference to 'call' sample (e.g. db_id) 56 58 * @return_ref: external reference to 'return' sample (e.g. db_id) 57 59 * @db_id: id used for db-export ··· 67 65 u64 call_time; 68 66 u64 return_time; 69 67 u64 branch_count; 68 + u64 insn_count; 69 + u64 cyc_count; 70 70 u64 call_ref; 71 71 u64 return_ref; 72 72 u64 db_id;