tracing: Add hist trigger support for user-defined sorting ('sort=' param)
authorTom Zanussi <tom.zanussi@linux.intel.com>
Thu, 3 Mar 2016 18:54:45 +0000 (12:54 -0600)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 19 Apr 2016 16:17:19 +0000 (12:17 -0400)
commite62347d2453474fa514fbbbc4636313d34d3c850
treec87e094f3d15d018312aef638b1c278c4a146d8d
parent76a3b0c8ac344e1d0f436160cbb59b670b086947
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>
kernel/trace/trace.c
kernel/trace/trace_events_hist.c