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

Configure Feed

Select the types of activity you want to include in your feed.

perf diff: Support --cpu filter option

To improve 'perf diff', implement a --cpu filter option.

Multiple CPUs can be provided as a comma-separated list with no space:
0,1. Ranges of CPUs are specified with -: 0-2. Default is to report
samples on all CPUs.

For example,

perf diff --cpu 0,1

It only diff the samples for CPU0 and CPU1.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1551791143-10334-3-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jin Yao and committed by
Arnaldo Carvalho de Melo
daca23b2 4802138d

+21
+5
tools/perf/Documentation/perf-diff.txt
··· 163 163 the end of perf.data.old and analyzes the perf.data from the 164 164 timestamp 3971.150589 to the end of perf.data. 165 165 166 + --cpu:: Only diff samples for the list of CPUs provided. Multiple CPUs can 167 + be provided as a comma-separated list with no space: 0,1. Ranges of 168 + CPUs are specified with -: 0-2. Default is to report samples on all 169 + CPUs. 170 + 166 171 COMPARISON 167 172 ---------- 168 173 The comparison is governed by the baseline file. The baseline perf.data
+16
tools/perf/builtin-diff.c
··· 83 83 static s64 compute_wdiff_w1; 84 84 static s64 compute_wdiff_w2; 85 85 86 + static const char *cpu_list; 87 + static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); 88 + 86 89 enum { 87 90 COMPUTE_DELTA, 88 91 COMPUTE_RATIO, ··· 355 352 pr_warning("problem processing %d event, skipping it.\n", 356 353 event->header.type); 357 354 return -1; 355 + } 356 + 357 + if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) { 358 + ret = 0; 359 + goto out_put; 358 360 } 359 361 360 362 if (!hists__add_entry(hists, &al, NULL, NULL, NULL, sample, true)) { ··· 900 892 goto out_delete; 901 893 } 902 894 895 + if (cpu_list) { 896 + ret = perf_session__cpu_bitmap(d->session, cpu_list, 897 + cpu_bitmap); 898 + if (ret < 0) 899 + goto out_delete; 900 + } 901 + 903 902 ret = perf_session__process_events(d->session); 904 903 if (ret) { 905 904 pr_err("Failed to process %s\n", d->data.path); ··· 984 969 "How to display percentage of filtered entries", parse_filter_percentage), 985 970 OPT_STRING(0, "time", &pdiff.time_str, "str", 986 971 "Time span (time percent or absolute timestamp)"), 972 + OPT_STRING(0, "cpu", &cpu_list, "cpu", "list of cpus to profile"), 987 973 OPT_END() 988 974 }; 989 975