Skip to contentSkip to conversation

perf report: Allow configuring the default sort order in ~/.perfconfig

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Aug 24, 2016 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  fa1f456592347c6f40c9d37ea407b029fda5324a
Gitweb:     http://git.kernel.org/tip/fa1f456592347c6f40c9d37ea407b029fda5324a
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 12 Aug 2016 20:41:01 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf report: Allow configuring the default sort order in ~/.perfconfig

Allows changing the default sort order from "comm,dso,symbol" to some other default, for instance "sym,dso" may be more fitting for kernel developers.

---
 tools/perf/Documentation/perf-config.txt | 4 ++++
 tools/perf/builtin-report.c              | 4 ++++
 tools/perf/util/sort.c                   | 2 +-
 tools/perf/util/sort.h                   | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-config.txt +4 -0
index 15949e2..68c8919 100644
@@ -382,6 +382,10 @@ call-graph.*::
 		histogram entry. Default is 0 which means no limitation.
 
 report.*::
+	report.sort_order::
+		Allows changing the default sort order from "comm,dso,symbol" to
+		some other default, for instance "sym,dso" may be more fitting for
+		kernel developers.
 	report.percent-limit::
 		This one is mostly the same as call-graph.threshold but works for
 		histogram entries. Entries having an overhead lower than this
tools/perf/builtin-report.c +4 -0
index 949e5a1..b9e046b 100644
@@ -89,6 +89,10 @@ static int report__config(const char *var, const char *value, void *cb)
 		rep->queue_size = perf_config_u64(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "report.sort_order")) {
+		default_sort_order = strdup(value);
+		return 0;
+	}
 
 	return 0;
 }
tools/perf/util/sort.c +1 -1
index 5ae3d32..1884d7f 100644
@@ -11,7 +11,7 @@
 regex_t		parent_regex;
 const char	default_parent_pattern[] = "^sys_|^do_page_fault";
 const char	*parent_pattern = default_parent_pattern;
-const char	default_sort_order[] = "comm,dso,symbol";
+const char	*default_sort_order = "comm,dso,symbol";
 const char	default_branch_sort_order[] = "comm,dso_from,symbol_from,symbol_to,cycles";
 const char	default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked";
 const char	default_top_sort_order[] = "dso,symbol";
tools/perf/util/sort.h +1 -1
index 7ca37ea..28c0524 100644
@@ -28,7 +28,7 @@ extern const char *sort_order;
 extern const char *field_order;
 extern const char default_parent_pattern[];
 extern const char *parent_pattern;
-extern const char default_sort_order[];
+extern const char *default_sort_order;
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
 extern enum sort_mode sort__mode;