[PATCH v3 0/3] tracing/hist: Add percentage histogram suffixes

From: Masami Hiramatsu (Google)
Date: Mon Aug 22 2022 - 22:59:06 EST


Hi,

Here is the 3rd version of .percent and .graph suffixes for histogram
trigger to show the value in percentage and in bar-graph respectively.

I added one minor bugfix patch and update original patches to show
hitcount.graph and hitcount.percent correctly.

This will help us to check the trend of the histogram instantly
without the post processing tool.

Here shows the example of the percentage and the bar graph of
the hitcount of the running tasks.

# cd /sys/kernel/debug/tracing/
# echo hist:keys=pid:vals=hitcount.percent,hitcount.graph:sort=pid > \
events/sched/sched_stat_runtime/trigger
# sleep 10
# cat events/sched/sched_stat_runtime/hist
# event histogram
#
# trigger info: hist:keys=pid:vals=hitcount,hitcount.percent,hitcount.graph:sort=pid:size=2048 [active]
#

{ pid: 8 } hitcount: 3 hitcount (%): 3.33 hitcount: ###
{ pid: 16 } hitcount: 10 hitcount (%): 11.11 hitcount: ##########
{ pid: 26 } hitcount: 1 hitcount (%): 1.11 hitcount: #
{ pid: 57 } hitcount: 3 hitcount (%): 3.33 hitcount: ###
{ pid: 61 } hitcount: 20 hitcount (%): 22.22 hitcount: ####################
{ pid: 64 } hitcount: 3 hitcount (%): 3.33 hitcount: ###
{ pid: 69 } hitcount: 2 hitcount (%): 2.22 hitcount: ##
{ pid: 70 } hitcount: 1 hitcount (%): 1.11 hitcount: #
{ pid: 77 } hitcount: 10 hitcount (%): 11.11 hitcount: ##########
{ pid: 124 } hitcount: 2 hitcount (%): 2.22 hitcount: ##
{ pid: 130 } hitcount: 2 hitcount (%): 2.22 hitcount: ##
{ pid: 146 } hitcount: 18 hitcount (%): 20.00 hitcount: ##################
{ pid: 153 } hitcount: 8 hitcount (%): 8.88 hitcount: ########
{ pid: 154 } hitcount: 7 hitcount (%): 7.77 hitcount: #######

Totals:
Hits: 90
Entries: 14
Dropped: 0

Thank you,

---

Masami Hiramatsu (Google) (3):
tracing: Fix to check event_mutex is held while accessing trigger list
tracing: Add .percent suffix option to histogram values
tracing: Add .graph suffix option to histogram value


kernel/trace/trace.c | 3 -
kernel/trace/trace_events_hist.c | 160 +++++++++++++++++++++++++++++++----
kernel/trace/trace_events_trigger.c | 3 -
3 files changed, 147 insertions(+), 19 deletions(-)

--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>