Message ID | 20230929100025.1018258-1-rostedt@goodmis.org (mailing list archive) |
---|---|
Headers | show |
Series | libtraceeval: Remove the need of TRACEEVAL_TYPE_NONE | expand |
On Fri, Sep 29, 2023 at 06:00:23AM -0400, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > The use of macros to determine the size of the keys and vals arrays made > me think a bit more about how we initialize the traceeval. The more I'm > using the library, the less I like having to add the TRACEEVAL_TYPE_NONE > to the end of the keys and vals array. > > Instead, use the same macro trick of TRACEEVAL_ARRAY_SIZE() to determine > the number of elements. Still allow the use of using the > TRACEEVAL_TYPE_NONE to determine the size (if the number passed in is > still bigger), so that most applications that still use that still work. > > I made the change separate than updating the sample code to test that > the old way still works. Then I updated the sample to make sure the new > way works. Perhaps when we add unit tests back in, we'll test both > cases. Looks good, you can add: Reviewed-by: Ross Zwisler <zwisler@google.com> > Steven Rostedt (Google) (2): > libtraceeval: Remove need to use TRACEEVAL_TYPE_NONE in keys and vals > libtraceeval samples: Remove adding TRACEEVAL_TYPE_NONE to keys and > vals > > include/traceeval-hist.h | 11 +++++++++-- > samples/task-eval.c | 18 ------------------ > src/histograms.c | 11 +++++++---- > 3 files changed, 16 insertions(+), 24 deletions(-) > > -- > 2.40.1 >
On Mon, Oct 02, 2023 at 03:07:49PM -0600, Ross Zwisler wrote: > On Fri, Sep 29, 2023 at 06:00:23AM -0400, Steven Rostedt wrote: > > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > > > The use of macros to determine the size of the keys and vals arrays made > > me think a bit more about how we initialize the traceeval. The more I'm > > using the library, the less I like having to add the TRACEEVAL_TYPE_NONE > > to the end of the keys and vals array. > > > > Instead, use the same macro trick of TRACEEVAL_ARRAY_SIZE() to determine > > the number of elements. Still allow the use of using the > > TRACEEVAL_TYPE_NONE to determine the size (if the number passed in is > > still bigger), so that most applications that still use that still work. > > > > I made the change separate than updating the sample code to test that > > the old way still works. Then I updated the sample to make sure the new > > way works. Perhaps when we add unit tests back in, we'll test both > > cases. > > Looks good, you can add: > Reviewed-by: Ross Zwisler <zwisler@google.com> Actually, I think we need to make similar updates in check_keys() and check_vals(), else calls to traceeval_init_data_size() will walk off the end of those respective arrays. > > > Steven Rostedt (Google) (2): > > libtraceeval: Remove need to use TRACEEVAL_TYPE_NONE in keys and vals > > libtraceeval samples: Remove adding TRACEEVAL_TYPE_NONE to keys and > > vals > > > > include/traceeval-hist.h | 11 +++++++++-- > > samples/task-eval.c | 18 ------------------ > > src/histograms.c | 11 +++++++---- > > 3 files changed, 16 insertions(+), 24 deletions(-) > > > > -- > > 2.40.1 > >
On Mon, 2 Oct 2023 15:18:26 -0600 Ross Zwisler <zwisler@google.com> wrote: > > Looks good, you can add: > > Reviewed-by: Ross Zwisler <zwisler@google.com> > > Actually, I think we need to make similar updates in check_keys() and > check_vals(), else calls to traceeval_init_data_size() will walk off the end > of those respective arrays. Good catch! I'm surprised this didn't crash it my testing. Maybe it as just aligned in a way that there was a NULL after it. -- Steve
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> The use of macros to determine the size of the keys and vals arrays made me think a bit more about how we initialize the traceeval. The more I'm using the library, the less I like having to add the TRACEEVAL_TYPE_NONE to the end of the keys and vals array. Instead, use the same macro trick of TRACEEVAL_ARRAY_SIZE() to determine the number of elements. Still allow the use of using the TRACEEVAL_TYPE_NONE to determine the size (if the number passed in is still bigger), so that most applications that still use that still work. I made the change separate than updating the sample code to test that the old way still works. Then I updated the sample to make sure the new way works. Perhaps when we add unit tests back in, we'll test both cases. Steven Rostedt (Google) (2): libtraceeval: Remove need to use TRACEEVAL_TYPE_NONE in keys and vals libtraceeval samples: Remove adding TRACEEVAL_TYPE_NONE to keys and vals include/traceeval-hist.h | 11 +++++++++-- samples/task-eval.c | 18 ------------------ src/histograms.c | 11 +++++++---- 3 files changed, 16 insertions(+), 24 deletions(-)