From: Steven Rostedt <rostedt@goodmis.org>
To: Stevie Alvarez <stevie.6strings@gmail.com>
Cc: linux-trace-devel@vger.kernel.org, Ross Zwisler <zwisler@google.com>
Subject: Re: [PATCH v3 3/6] histograms: Add traceeval compare
Date: Tue, 8 Aug 2023 14:18:16 -0400 [thread overview]
Message-ID: <20230808141816.38d8fade@gandalf.local.home> (raw)
In-Reply-To: <20230808161204.5704-4-stevie.6strings@gmail.com>
On Tue, 8 Aug 2023 12:11:56 -0400
Stevie Alvarez <stevie.6strings@gmail.com> wrote:
> From: Stevie Alvarez (Google) <stevie.6strings@gmail.com>
>
> traceeval_compare() compares two struct traceeval instances for
> equality. This suite of comparitors was made for testing purposes.
>
> Signed-off-by: Stevie Alvarez (Google) <stevie.6strings@gmail.com>
> ---
> include/traceeval-test.h | 16 +++
> src/histograms.c | 213 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 229 insertions(+)
> create mode 100644 include/traceeval-test.h
>
> diff --git a/include/traceeval-test.h b/include/traceeval-test.h
> new file mode 100644
> index 0000000..bb8092a
> --- /dev/null
> +++ b/include/traceeval-test.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * libtraceeval interface for unit testing.
> + *
> + * Copyright (C) 2023 Google Inc, Steven Rostedt <rostedt@goodmis.org>
> + * Copyright (C) 2023 Google Inc, Stevie Alvarez <stevie.6strings@gmail.com>
> + */
> +
> +#ifndef __LIBTRACEEVAL_TEST_H__
> +#define __LIBTRACEEVAL_TEST_H__
> +
> +#include <traceeval-hist.h>
> +
> +int traceeval_compare(struct traceeval *orig, struct traceeval *copy);
> +
> +#endif /* __LIBTRACEEVAL_TEST_H__ */
> diff --git a/src/histograms.c b/src/histograms.c
> index b85d1a8..6fac205 100644
> --- a/src/histograms.c
> +++ b/src/histograms.c
> @@ -11,6 +11,20 @@
> #include <stdio.h>
>
> #include <traceeval-hist.h>
> +#include <traceeval-test.h>
Note, for anything that is not going to be installed in the system, I
prefer to use "" includes. It lets you know that it's local to the repo.
#include <traceeval-hist.h>
#include "traceeval-test.h"
-- Steve
> +
> +/*
> + * Compare two integers of variable length.
> + *
> + * Return 0 if @a and @b are the same, 1 if @a is greater than @b, and -1
> + * if @b is greater than @a.
> + */
> +#define compare_numbers_return(a, b) \
> +do { \
> + if ((a) < (b)) \
> + return -1; \
> + return (a) != (b); \
> +} while (0) \
>
> /* A key-value pair */
> struct entry {
> @@ -48,6 +62,205 @@ static void print_err(const char *fmt, ...)
> fprintf(stderr, "\n");
> }
>
next prev parent reply other threads:[~2023-08-08 19:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 16:11 [PATCH v3 0/6] histograms: Add query and insert Stevie Alvarez
2023-08-08 16:11 ` [PATCH v3 1/6] histograms: Initial histograms interface Stevie Alvarez
2023-08-08 18:08 ` Steven Rostedt
2023-08-08 19:35 ` Steven Rostedt
2023-08-08 21:51 ` Stevie Alvarez
2023-08-09 0:56 ` Steven Rostedt
2023-08-08 20:05 ` Steven Rostedt
2023-08-08 16:11 ` [PATCH v3 2/6] histograms: Add traceeval initialize and release Stevie Alvarez
2023-08-08 18:15 ` Steven Rostedt
2023-08-08 16:11 ` [PATCH v3 3/6] histograms: Add traceeval compare Stevie Alvarez
2023-08-08 18:18 ` Steven Rostedt [this message]
2023-08-08 16:11 ` [PATCH v3 4/6] histograms: Add traceeval query Stevie Alvarez
2023-08-08 18:55 ` Steven Rostedt
2023-08-08 16:11 ` [PATCH v3 5/6] histograms: Add traceeval insert Stevie Alvarez
2023-08-08 19:59 ` Ross Zwisler
2023-08-08 23:32 ` Stevie Alvarez
2023-08-08 23:51 ` Ross Zwisler
2023-08-08 18:01 ` [PATCH v3 0/6] histograms: Add query and insert Stevie Alvarez
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=20230808141816.38d8fade@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=stevie.6strings@gmail.com \
--cc=zwisler@google.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 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).