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

perf diff: Add diff.order config option

In many cases, I need to look at differences between two data so I often
used the -o option to sort the result base on the difference first.
It'd be nice to have a config option to set it by default.

The diff.order config option is to set the default value of -o/--order
option.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Taeung Song <treeze.taeung@gmail.com>
Link: http://lkml.kernel.org/r/20170210073614.24584-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
d49dd15d a1668c25

+26 -1
+7
tools/perf/Documentation/perf-config.txt
··· 498 498 But if this option is 'no-cache', it will not update the build-id cache. 499 499 'skip' skips post-processing and does not update the cache. 500 500 501 + diff.*:: 502 + diff.order:: 503 + This option sets the number of columns to sort the result. 504 + The default is 0, which means sorting by baseline. 505 + Setting it to 1 will sort the result by delta (or other 506 + compute method selected). 507 + 501 508 SEE ALSO 502 509 -------- 503 510 linkperf:perf[1]
+5 -1
tools/perf/Documentation/perf-diff.txt
··· 99 99 100 100 -o:: 101 101 --order:: 102 - Specify compute sorting column number. 102 + Specify compute sorting column number. 0 means sorting by baseline 103 + overhead (default) and 1 means sorting by computed value of column 1 104 + (data from the first file other base baseline). Values more than 1 105 + can be used only if enough data files are provided. 106 + The default value can be set using the diff.order config option. 103 107 104 108 --percentage:: 105 109 Determine how to display the overhead percentage of filtered entries.
+14
tools/perf/builtin-diff.c
··· 17 17 #include "util/symbol.h" 18 18 #include "util/util.h" 19 19 #include "util/data.h" 20 + #include "util/config.h" 20 21 21 22 #include <stdlib.h> 22 23 #include <math.h> ··· 1292 1291 return 0; 1293 1292 } 1294 1293 1294 + static int diff__config(const char *var, const char *value, 1295 + void *cb __maybe_unused) 1296 + { 1297 + if (!strcmp(var, "diff.order")) { 1298 + sort_compute = perf_config_int(var, value); 1299 + return 0; 1300 + } 1301 + 1302 + return 0; 1303 + } 1304 + 1295 1305 int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) 1296 1306 { 1297 1307 int ret = hists__init(); 1298 1308 1299 1309 if (ret < 0) 1300 1310 return ret; 1311 + 1312 + perf_config(diff__config, NULL); 1301 1313 1302 1314 argc = parse_options(argc, argv, options, diff_usage, 0); 1303 1315