linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 1/6] histograms: Initial histograms interface
Date: Tue, 8 Aug 2023 14:08:33 -0400	[thread overview]
Message-ID: <20230808140833.18136ec0@gandalf.local.home> (raw)
In-Reply-To: <20230808161204.5704-2-stevie.6strings@gmail.com>

On Tue,  8 Aug 2023 12:11:54 -0400
Stevie Alvarez <stevie.6strings@gmail.com> wrote:

> From: Stevie Alvarez (Google) <stevie.6strings@gmail.com>
> 
> Initial header file for libtraceeval's histogram API. The interface
> provides a simple way of aggregating trace data and reading through said
> data.
> 
> Signed-off-by: Stevie Alvarez (Google) <stevie.6strings@gmail.com>
> ---
>  include/traceeval-hist.h | 130 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 130 insertions(+)
>  create mode 100644 include/traceeval-hist.h
> 
> diff --git a/include/traceeval-hist.h b/include/traceeval-hist.h
> new file mode 100644
> index 0000000..ebce94e
> --- /dev/null
> +++ b/include/traceeval-hist.h
> @@ -0,0 +1,130 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * libtraceeval histogram interface.
> + *
> + * Copyright (C) 2023 Google Inc, Steven Rostedt <rostedt@goodmis.org>
> + * Copyright (C) 2023 Google Inc, Stevie Alvarez <stevie.6strings@gmail.com>
> + */
> +#ifndef __LIBTRACEEVAL_HIST_H__
> +#define __LIBTRACEEVAL_HIST_H__
> +
> +#include <stdlib.h>
> +#include <stddef.h>
> +#include <stdbool.h>
> +
> +/* Data definition interfaces */
> +
> +/* Field name/descriptor for number of hits */
> +#define TRACEEVAL_VAL_HITS ((const char *)(-1UL))
> +
> +/* Data type distinguishers */
> +enum traceeval_data_type {
> +	TRACEEVAL_TYPE_NONE,

> +	TRACEEVAL_TYPE_NUMBER_64,
> +	TRACEEVAL_TYPE_NUMBER_32,
> +	TRACEEVAL_TYPE_NUMBER_16,
> +	TRACEEVAL_TYPE_NUMBER_8,

Should be the other way around:

	TRACEEVAL_TYPE_NUMBER_8,
	TRACEEVAL_TYPE_NUMBER_16,
	TRACEEVAL_TYPE_NUMBER_32,
	TRACEEVAL_TYPE_NUMBER_64,

So that _8 = 1, _16 = 2, _32 = 3 and _64 = 4

Which would allow for the:

  2^(1 * (enum - 1))

algorithm.



> +	TRACEEVAL_TYPE_NUMBER,
> +	TRACEEVAL_TYPE_STRING,
> +	TRACEEVAL_TYPE_DYNAMIC
> +};
> +
> +/* Statistics specification flags */
> +enum traceeval_flags {
> +	TRACEEVAL_FL_SIGNED		= (1 << 0),
> +	TRACEEVAL_FL_TIMESTAMP		= (1 << 1),
> +};
> +
> +/*
> + * Trace data entry for a traceeval histogram
> + * Constitutes keys and values.
> + */
> +union traceeval_data {
> +	char				*string;
> +	struct traceeval_dynamic	*dyn_data;
> +	unsigned long long		number_64;
> +	unsigned long			number;

As this is a union, order doesn't matter (for sizes). But for aesthetics,
perhaps switch the _64 with the number.

	unsigned long			number;
	unsigned long long		number_64;

To keep all the "number_*" together.

> +	unsigned int			number_32;
> +	unsigned short			number_16;
> +	unsigned char			number_8;
> +};
> +

-- Steve

  reply	other threads:[~2023-08-08 19:56 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 [this message]
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
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=20230808140833.18136ec0@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).