All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <zwisler@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org,
	Stevie Alvarez <stevie.6strings@gmail.com>
Subject: Re: [PATCH 9/9] libtraceeval: Only do stats on values marked with the STAT flag
Date: Thu, 24 Aug 2023 16:02:44 -0600	[thread overview]
Message-ID: <20230824220244.GH110858@google.com> (raw)
In-Reply-To: <20230817222422.118568-10-rostedt@goodmis.org>

On Thu, Aug 17, 2023 at 06:24:22PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> Add TRACEEVAL_FL_STAT to perform stats on the value, otherwise ignore it.
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  include/traceeval-hist.h | 1 +
>  samples/task-eval.c      | 1 +
>  src/histograms.c         | 2 +-
>  3 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/traceeval-hist.h b/include/traceeval-hist.h
> index 81fe805e691d..34f01a51a334 100644
> --- a/include/traceeval-hist.h
> +++ b/include/traceeval-hist.h
> @@ -36,6 +36,7 @@ enum traceeval_flags {
>  	TRACEEVAL_FL_VALUE		= (1 << 1),
>  	TRACEEVAL_FL_SIGNED		= (1 << 2),
>  	TRACEEVAL_FL_TIMESTAMP		= (1 << 3),
> +	TRACEEVAL_FL_STAT		= (1 << 3),

	TRACEEVAL_FL_STAT		= (1 << 4),

>  };
>  
>  /*
> diff --git a/samples/task-eval.c b/samples/task-eval.c
> index ed3a1a95f097..0e3acb7644ef 100644
> --- a/samples/task-eval.c
> +++ b/samples/task-eval.c
> @@ -147,6 +147,7 @@ static struct traceeval_type delta_vals[] = {
>  	{
>  		.type	= TRACEEVAL_TYPE_NUMBER_64,
>  		.name	= "delta",
> +		.flags = TRACEEVAL_FL_STAT,
>  	},
>  	{
>  		.type	= TRACEEVAL_TYPE_NONE,
> diff --git a/src/histograms.c b/src/histograms.c
> index 973bf3ad279c..8f1cf4187713 100644
> --- a/src/histograms.c
> +++ b/src/histograms.c
> @@ -571,7 +571,7 @@ static int copy_traceeval_data(struct traceeval_type *type,
>  		return 0;
>  	}
>  
> -	if (!stat)
> +	if (!stat || !(type->flags & TRACEEVAL_FL_STAT))

I think we actually want to check the TRACEEVAL_FL_STAT flag in is_stat_type()
and then use that check here.  This will help cover other cases where the type
means we can keep stats (values which are numbers) but we can bail if the flag
isn't set.

This will cover traceeval_stat() and traceeval_iterator_stat().

>  		return 0;
>  
>  	if (!stat->count++) {
> -- 
> 2.40.1
> 

      reply	other threads:[~2023-08-24 22:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17 22:24 [PATCH 0/9] libtraceeval: Even more updates! Steven Rostedt
2023-08-17 22:24 ` [PATCH 1/9] libtraceeval: Add check for updates to know to recreate iter array Steven Rostedt
2023-08-24 19:41   ` Ross Zwisler
2023-08-17 22:24 ` [PATCH 2/9] libtraceeval: Add traceeval_iterator_query() Steven Rostedt
2023-08-17 22:50   ` Steven Rostedt
2023-08-20 18:18   ` Stevie Alvarez
2023-08-21 14:33     ` Steven Rostedt
2023-08-24 19:57   ` Ross Zwisler
2023-08-17 22:24 ` [PATCH 3/9] libtraceeval: Add traceeval_iterator_stat() Steven Rostedt
2023-08-24 20:07   ` Ross Zwisler
2023-08-17 22:24 ` [PATCH 4/9] libtraceeval: Add traceeval_iterator_remove() Steven Rostedt
2023-08-24 20:19   ` Ross Zwisler
2023-08-24 20:23     ` Ross Zwisler
2023-09-27  9:51       ` Steven Rostedt
2023-09-27  9:09     ` Steven Rostedt
2023-08-17 22:24 ` [PATCH 5/9] libtraceeval histogram: Add type to traceeval_data and make it a structure Steven Rostedt
2023-08-24 21:09   ` Ross Zwisler
2023-08-17 22:24 ` [PATCH 6/9] libtraceveal: Add type checks to traceeval_data vals and keys Steven Rostedt
2023-08-24 21:23   ` Ross Zwisler
2023-08-17 22:24 ` [PATCH 7/9] libtraceeval: Add size checks to insert and query functions Steven Rostedt
2023-08-17 22:39   ` Steven Rostedt
2023-08-17 22:24 ` [PATCH 8/9] libtraceeval: Add checks to traceeval_insert() and query() Steven Rostedt
2023-08-24 21:36   ` Ross Zwisler
2023-08-17 22:24 ` [PATCH 9/9] libtraceeval: Only do stats on values marked with the STAT flag Steven Rostedt
2023-08-24 22:02   ` Ross Zwisler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230824220244.GH110858@google.com \
    --to=zwisler@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stevie.6strings@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.