Re: [PATCH 1/5] tracing: Add support for creating hist trigger variables from literal

From: Steven Rostedt
Date: Tue Oct 19 2021 - 16:48:40 EST


On Wed, 15 Sep 2021 19:52:45 +0000
Kalesh Singh <kaleshsingh@xxxxxxxxxx> wrote:

> Currently hist trigger expressions don't support the use of numeric
> literals:
> e.g. echo 'hist:keys=common_pid:x=$y-1234'
> --> is not valid expression syntax
>
> Having the ability to use numeric constants in hist triggers supports
> a wider range of expressions for creating variables.

I'm not against the patch, but I'm curious to what use case this would be
useful for. In the cover letter it mentions the division and multiplication
for finding associated buckets, but what is the addition / subtraction used
for?

-- Steve


>
> Add support for creating trace event histogram variables from numeric
> literals.
>
> e.g. echo 'hist:keys=common_pid:x=1234,y=size-1024' >> event/trigger
>
> A negative numeric constant is created, using unary minus operator
> (parentheses are required).
>
> e.g. echo 'hist:keys=common_pid:z=-(2)' >> event/trigger
>
> Signed-off-by: Kalesh Singh <kaleshsingh@xxxxxxxxxx>
>