[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211020013153.4106001-6-kaleshsingh@google.com>
Date: Tue, 19 Oct 2021 18:31:42 -0700
From: Kalesh Singh <kaleshsingh@...gle.com>
To: unlisted-recipients:; (no To-header on input)
Cc: surenb@...gle.com, hridya@...gle.com, namhyung@...nel.org,
kernel-team@...roid.com, Kalesh Singh <kaleshsingh@...gle.com>,
Jonathan Corbet <corbet@....net>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>, Shuah Khan <shuah@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Tom Zanussi <zanussi@...nel.org>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: [PATCH v2 5/5] tracing/histogram: Document expression arithmetic and constants
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.
Signed-off-by: Kalesh Singh <kaleshsingh@...gle.com>
Reviewed-by: Namhyung Kim <namhyung@...nel.org>
---
Changes in v2:
- Add Namhyung's Reviewed-by
Documentation/trace/histogram.rst | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst
index 533415644c54..e12699abaee8 100644
--- a/Documentation/trace/histogram.rst
+++ b/Documentation/trace/histogram.rst
@@ -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
----------------------
--
2.33.0.1079.g6e70778dc9-goog
Powered by blists - more mailing lists