aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-diff.c')
-rw-r--r--tools/perf/builtin-diff.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 17cd898074c8..dfe6c7606f5a 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -83,6 +83,9 @@ static unsigned int sort_compute = 1;
83static s64 compute_wdiff_w1; 83static s64 compute_wdiff_w1;
84static s64 compute_wdiff_w2; 84static s64 compute_wdiff_w2;
85 85
86static const char *cpu_list;
87static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
88
86enum { 89enum {
87 COMPUTE_DELTA, 90 COMPUTE_DELTA,
88 COMPUTE_RATIO, 91 COMPUTE_RATIO,
@@ -354,6 +357,11 @@ static int diff__process_sample_event(struct perf_tool *tool,
354 return -1; 357 return -1;
355 } 358 }
356 359
360 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) {
361 ret = 0;
362 goto out_put;
363 }
364
357 if (!hists__add_entry(hists, &al, NULL, NULL, NULL, sample, true)) { 365 if (!hists__add_entry(hists, &al, NULL, NULL, NULL, sample, true)) {
358 pr_warning("problem incrementing symbol period, skipping event\n"); 366 pr_warning("problem incrementing symbol period, skipping event\n");
359 goto out_put; 367 goto out_put;
@@ -892,6 +900,13 @@ static int __cmd_diff(void)
892 goto out_delete; 900 goto out_delete;
893 } 901 }
894 902
903 if (cpu_list) {
904 ret = perf_session__cpu_bitmap(d->session, cpu_list,
905 cpu_bitmap);
906 if (ret < 0)
907 goto out_delete;
908 }
909
895 ret = perf_session__process_events(d->session); 910 ret = perf_session__process_events(d->session);
896 if (ret) { 911 if (ret) {
897 pr_err("Failed to process %s\n", d->data.path); 912 pr_err("Failed to process %s\n", d->data.path);
@@ -969,6 +984,7 @@ static const struct option options[] = {
969 "How to display percentage of filtered entries", parse_filter_percentage), 984 "How to display percentage of filtered entries", parse_filter_percentage),
970 OPT_STRING(0, "time", &pdiff.time_str, "str", 985 OPT_STRING(0, "time", &pdiff.time_str, "str",
971 "Time span (time percent or absolute timestamp)"), 986 "Time span (time percent or absolute timestamp)"),
987 OPT_STRING(0, "cpu", &cpu_list, "cpu", "list of cpus to profile"),
972 OPT_END() 988 OPT_END()
973}; 989};
974 990