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

From: Kalesh Singh
Date: Tue Oct 19 2021 - 17:21:18 EST


On Tue, Oct 19, 2021 at 1:48 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> 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?

Addition and subtraction are already supported operations. The use
case given in Documentation/trace/histogram.rst is for calculating
latencies. I don't have a use case where the constants may be needed
in the addition/subtraction, but for simplicity and completeness we
support them for all operations.

- Kalesh

>
> -- 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>
> >