From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Tom Zanussi <zanussi@kernel.org>
Subject: [for-next][PATCH 04/25] tracing: Allow multiple hitcount values in histograms
Date: Sat, 10 Dec 2022 08:57:54 -0500 [thread overview]
Message-ID: <20221210135823.843880038@goodmis.org> (raw)
In-Reply-To: 20221210135750.425719934@goodmis.org
From: Tom Zanussi <zanussi@kernel.org>
The hitcount is treated specially in the histograms - since it's
always expected to be there regardless of whether the user specified
anything or not, it's always added as the first histogram value.
Currently the code doesn't allow it to be added more than once as a
value, which is inconsistent with all the other possible values. It
would seem to be a pointless thing to want to do, but other features
being added such as percent and graph modifiers don't work properly
with the current hitcount restrictions.
Fix this by allowing multiple hitcounts to be added.
Link: https://lore.kernel.org/linux-trace-kernel/166610812248.56030.16754785928712505251.stgit@devnote2
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Tested-by: Tom Zanussi <zanussi@kernel.org>
---
kernel/trace/trace_events_hist.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 1c82478e8dff..31d58ddcc1d9 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -1356,6 +1356,8 @@ static const char *hist_field_name(struct hist_field *field,
field_name = field->name;
} else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
field_name = "common_timestamp";
+ else if (field->flags & HIST_FIELD_FL_HITCOUNT)
+ field_name = "hitcount";
if (field_name == NULL)
field_name = "";
@@ -2328,6 +2330,8 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
hist_data->attrs->ts_in_usecs = true;
} else if (strcmp(field_name, "common_cpu") == 0)
*flags |= HIST_FIELD_FL_CPU;
+ else if (strcmp(field_name, "hitcount") == 0)
+ *flags |= HIST_FIELD_FL_HITCOUNT;
else {
field = trace_find_event_field(file->event_call, field_name);
if (!field || !field->size) {
@@ -4328,8 +4332,8 @@ static int create_var_field(struct hist_trigger_data *hist_data,
static int create_val_fields(struct hist_trigger_data *hist_data,
struct trace_event_file *file)
{
+ unsigned int i, j = 1, n_hitcount = 0;
char *fields_str, *field_str;
- unsigned int i, j = 1;
int ret;
ret = create_hitcount_val(hist_data);
@@ -4346,8 +4350,10 @@ static int create_val_fields(struct hist_trigger_data *hist_data,
if (!field_str)
break;
- if (strcmp(field_str, "hitcount") == 0)
- continue;
+ if (strcmp(field_str, "hitcount") == 0) {
+ if (!n_hitcount++)
+ continue;
+ }
ret = create_val_field(hist_data, j++, file, field_str);
if (ret)
--
2.35.1
next prev parent reply other threads:[~2022-12-10 13:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-10 13:57 [for-next][PATCH 00/25] tracing: Updates for 6.2 Steven Rostedt
2022-12-10 13:57 ` [for-next][PATCH 01/25] tracing/user_events: Fix call print_fmt leak Steven Rostedt
2022-12-10 13:57 ` [for-next][PATCH 02/25] tracing: Update MAINTAINERS file for new patchwork and mailing list Steven Rostedt
2022-12-10 13:57 ` [for-next][PATCH 03/25] ftrace/x86: Add back ftrace_expected for ftrace bug reports Steven Rostedt
2022-12-10 13:57 ` Steven Rostedt [this message]
2022-12-10 13:57 ` [for-next][PATCH 05/25] tracing: Add .percent suffix option to histogram values Steven Rostedt
2022-12-10 13:57 ` [for-next][PATCH 06/25] tracing: Add .graph suffix option to histogram value Steven Rostedt
2022-12-10 13:57 ` [for-next][PATCH 07/25] tracing: Add nohitcount option for suppressing display of raw hitcount Steven Rostedt
2022-12-10 13:57 ` [for-next][PATCH 08/25] tracing: docs: Update histogram doc for .percent/.graph and nohitcount Steven Rostedt
2022-12-10 13:57 ` [for-next][PATCH 09/25] trace/kprobe: remove duplicated calls of ring_buffer_event_data Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 10/25] tracing/probes: Handle system names with hyphens Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 11/25] tracing: Fix complicated dependency of CONFIG_TRACER_MAX_TRACE Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 12/25] x86/mm/kmmio: Switch to arch_spin_lock() Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 13/25] x86/mm/kmmio: Use rcu_read_lock_sched_notrace() Steven Rostedt
2022-12-10 17:47 ` Paul E. McKenney
2022-12-10 18:34 ` Steven Rostedt
2022-12-10 21:34 ` Paul E. McKenney
2022-12-10 22:32 ` Steven Rostedt
2022-12-11 5:52 ` Paul E. McKenney
2022-12-10 23:30 ` Thomas Gleixner
2022-12-10 23:55 ` Steven Rostedt
2022-12-12 10:51 ` Thomas Gleixner
2022-12-12 15:42 ` Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 14/25] tracing/hist: Fix wrong return value in parse_action_params() Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 15/25] tracing/hist: Fix out-of-bound write on action_data.var_ref_idx Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 16/25] tracing: Fix issue of missing one synthetic field Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 17/25] tracing/hist: Fix issue of losting command info in error_log Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 18/25] ring-buffer: Handle resize in early boot up Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 19/25] tracing: remove unnecessary trace_trigger ifdef Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 20/25] tracing/osnoise: Make osnoise_options static Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 21/25] tracing: Fix some checker warnings Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 22/25] Documentation/osnoise: Escape underscore of NO_ prefix Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 23/25] tracing/osnoise: Add PANIC_ON_STOP option Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 24/25] tracing/osnoise: Add preempt and/or irq disabled options Steven Rostedt
2022-12-10 13:58 ` [for-next][PATCH 25/25] Documentation/osnoise: Add osnoise/options documentation 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=20221210135823.843880038@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=zanussi@kernel.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