summaryrefslogtreecommitdiff
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2016-03-03 18:54:45 (GMT)
committerSteven Rostedt <rostedt@goodmis.org>2016-04-19 16:17:19 (GMT)
commite62347d2453474fa514fbbbc4636313d34d3c850 (patch)
treec87e094f3d15d018312aef638b1c278c4a146d8d /kernel/trace/trace.c
parent76a3b0c8ac344e1d0f436160cbb59b670b086947 (diff)
downloadlinux-e62347d2453474fa514fbbbc4636313d34d3c850.tar.xz
tracing: Add hist trigger support for user-defined sorting ('sort=' param)
Allow users to specify keys and/or values to sort on. With this addition, keys and values specified using the 'keys=' and 'vals=' keywords can be used to sort the hist trigger output via a new 'sort=' keyword. If multiple sort keys are specified, the output will be sorted using the second key as a secondary sort key, etc. The default sort order is ascending; if the user wants a different sort order, '.descending' can be appended to the specific sort key. Before this addition, output was always sorted by 'hitcount' in ascending order. This expands the hist trigger syntax from this: # echo hist:keys=xxx:vals=yyy \ [ if filter] > event/trigger to this: # echo hist:keys=xxx:vals=yyy:sort=zzz.descending \ [ if filter] > event/trigger Link: http://lkml.kernel.org/r/b30a41db66ba486979c4f987aff5fab500ea53b3.1457029949.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7a4c4dc..d16fa8e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3835,6 +3835,7 @@ static const char readme_msg[] =
" hist trigger\t- If set, event hits are aggregated into a hash table\n"
"\t Format: hist:keys=<field1[,field2,...]>\n"
"\t [:values=<field1[,field2,...]>]\n"
+ "\t [:sort=<field1[,field2,...]>]\n"
"\t [:size=#entries]\n"
"\t [if <filter>]\n\n"
"\t When a matching event is hit, an entry is added to a hash\n"
@@ -3843,7 +3844,10 @@ static const char readme_msg[] =
"\t correspond to fields in the event's format description. Keys\n"
"\t can be any field. Compound keys consisting of up to two\n"
"\t fields can be specified by the 'keys' keyword. Values must\n"
- "\t correspond to numeric fields. The 'size' parameter can be\n"
+ "\t correspond to numeric fields. Sort keys consisting of up to\n"
+ "\t two fields can be specified using the 'sort' keyword. The\n"
+ "\t sort direction can be modified by appending '.descending' or\n"
+ "\t '.ascending' to a sort field. The 'size' parameter can be\n"
"\t used to specify more or fewer than the default 2048 entries\n"
"\t for the hashtable size.\n\n"
"\t Reading the 'hist' file for the event will dump the hash\n"