linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ross Zwisler <zwisler@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH] libtraceeval: Use name for type look up for traceeval_stat
Date: Wed, 4 Oct 2023 08:56:54 -0600	[thread overview]
Message-ID: <20231004145654.GA2510728@google.com> (raw)
In-Reply-To: <20231003181237.616cc8db@gandalf.local.home>

On Tue, Oct 03, 2023 at 06:12:37PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> The functions that retrieve the traceeval_stat currently requires passing
> in the struct traceeval_type. But this is fragile, as it may not be set up
> properly. It was originally done that way as a "fast" way to look up
> stats, but in reality it will likely just cause more issues with wrong
> types passed in. That decision was based more on defining policy which the
> library should not do.
> 
> Instead, just pass in the string name of the value type to find and
> retrieve the traceeval_data value from the traceeval that way.
> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  include/traceeval.h |  4 ++--
>  src/histograms.c    | 39 ++++++++++++++++++++++++++++++---------
>  2 files changed, 32 insertions(+), 11 deletions(-)
> 
> diff --git a/include/traceeval.h b/include/traceeval.h
> index 48c28dfc2f99..32996ba17e5f 100644
> --- a/include/traceeval.h
> +++ b/include/traceeval.h
> @@ -219,7 +219,7 @@ size_t traceeval_count(struct traceeval *teval);
>  struct traceeval_stat *traceeval_stat_size(struct traceeval *teval,
>  					   const struct traceeval_data *keys,
>  					   size_t nr_keys,
> -					   struct traceeval_type *type);
> +					   const char *val_name);

Probably need to also s/type/val_name/g for the traceeval_stat() macro so they
stay in sync, and need to update the calls to traceeval_iterator_stat() and
traceeval_stat() in samples/task-eval.c so they continue to work.

  reply	other threads:[~2023-10-04 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 22:12 [PATCH] libtraceeval: Use name for type look up for traceeval_stat Steven Rostedt
2023-10-04 14:56 ` Ross Zwisler [this message]
2023-10-04 21:54   ` Steven Rostedt

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=20231004145654.GA2510728@google.com \
    --to=zwisler@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).