Skip to content

Commit

Permalink
tracing/histogram: Document expression arithmetic and constants
Browse files Browse the repository at this point in the history
Histogram expressions now support division, and multiplication in
addition to the already supported subtraction and addition operators.

Numeric constants can also be used in a hist trigger expressions
or assigned to a variable and used by refernce in an expression.

Link: https://lkml.kernel.org/r/20211025200852.3002369-9-kaleshsingh@google.com

Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Kalesh Singh authored and rostedt committed Oct 27, 2021
1 parent 722edda commit 2d2f6d4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Documentation/trace/histogram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1763,6 +1763,20 @@ using the same key and variable from yet another event::

# echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ...' >> event3/trigger

Expressions support the use of addition, subtraction, multiplication and
division operators (+-*/).
Note that division by zero always returns -1.

Numeric constants can also be used directly in an expression::

# echo 'hist:keys=next_pid:timestamp_secs=common_timestamp/1000000 ...' >> event/trigger

or assigned to a variable and referenced in a subsequent expression::

# echo 'hist:keys=next_pid:us_per_sec=1000000 ...' >> event/trigger
# echo 'hist:keys=next_pid:timestamp_secs=common_timestamp/$us_per_sec ...' >> event/trigger

2.2.2 Synthetic Events
----------------------

Expand Down

0 comments on commit 2d2f6d4

Please sign in to comment.