On Tue, Oct 03, 2023 at 06:12:37PM -0400, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> > > 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@xxxxxxxxxxx> > --- > 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.