From: Steven Rostedt <rostedt@goodmis.org>
To: Binoy Jayan <binoy.jayan@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Daniel Wagner <daniel.wagner@bmw-carit.de>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org,
Masami <masami.hiramatsu@linaro.org>
Subject: Re: [PATCH v5 2/4] tracing: Add cpu as a key field in histogram
Date: Fri, 2 Sep 2016 09:09:52 -0400 [thread overview]
Message-ID: <20160902090952.7abb5324@gandalf.local.home> (raw)
In-Reply-To: <1472819851-12857-3-git-send-email-binoy.jayan@linaro.org>
On Fri, 2 Sep 2016 18:07:29 +0530
Binoy Jayan <binoy.jayan@linaro.org> wrote:
> The field 'cpu' although part of the set of generic fields, is not made
> part of the key fields when mentioned in the trigger command. This hack
> suggested by Daniel marks it as one of the key fields and make it appear
> in the histogram output.
>
> Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
> ---
> kernel/trace/trace_events.c | 3 ++-
> kernel/trace/trace_events_hist.c | 15 +++++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 03c0a48..c395608 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -152,7 +152,8 @@ EXPORT_SYMBOL_GPL(trace_define_field);
>
> #define __generic_field(type, item, filter_type) \
> ret = __trace_define_field(&ftrace_generic_fields, #type, \
> - #item, 0, 0, is_signed_type(type), \
> + #item, 0, sizeof(type), \
> + is_signed_type(type), \
> filter_type); \
> if (ret) \
> return ret;
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 0c05b8a..4e0a12e 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -75,6 +75,11 @@ static u64 hist_field_log2(struct hist_field *hist_field, void *event)
> return (u64) ilog2(roundup_pow_of_two(val));
> }
>
> +static u64 hist_field_cpu(struct hist_field *hist_field, void *event)
> +{
> + return (u64) raw_smp_processor_id();
Does this really need to be raw? I'm guessing that this would be called
always in preempt disabled locations, but if it is not, wouldn't we
want to know about it?
> +}
> +
> #define DEFINE_HIST_FIELD_FN(type) \
> static u64 hist_field_##type(struct hist_field *hist_field, void *event)\
> { \
> @@ -119,6 +124,7 @@ enum hist_field_flags {
> HIST_FIELD_FL_SYSCALL = 128,
> HIST_FIELD_FL_STACKTRACE = 256,
> HIST_FIELD_FL_LOG2 = 512,
> + HIST_FIELD_FL_CPU = 1024,
> };
>
> struct hist_trigger_attrs {
> @@ -371,6 +377,11 @@ static struct hist_field *create_hist_field(struct ftrace_event_field *field,
> goto out;
> }
>
> + if (flags & HIST_FIELD_FL_CPU) {
> + hist_field->fn = hist_field_cpu;
> + goto out;
> + }
> +
> if (WARN_ON_ONCE(!field))
> goto out;
>
> @@ -526,6 +537,9 @@ static int create_key_field(struct hist_trigger_data *hist_data,
> } else {
> char *field_name = strsep(&field_str, ".");
>
> + if (strcmp(field_name, "cpu") == 0)
> + flags |= HIST_FIELD_FL_CPU;
> +
> if (field_str) {
> if (strcmp(field_str, "hex") == 0)
> flags |= HIST_FIELD_FL_HEX;
> @@ -556,6 +570,7 @@ static int create_key_field(struct hist_trigger_data *hist_data,
> key_size = MAX_FILTER_STR_VAL;
> else
> key_size = field->size;
> +
Unnecessary white space.
-- Steve
> }
>
> hist_data->fields[key_idx] = create_hist_field(field, flags);
next prev parent reply other threads:[~2016-09-02 13:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 12:37 [PATCH v5 0/4] *** Latency histograms - IRQSOFF,PREEMPTOFF *** Binoy Jayan
2016-09-02 12:37 ` [PATCH v5 1/4] tracing: Deference pointers without RCU checks Binoy Jayan
2016-09-02 12:37 ` [PATCH v5 2/4] tracing: Add cpu as a key field in histogram Binoy Jayan
2016-09-02 13:09 ` Steven Rostedt [this message]
2016-09-05 5:40 ` Daniel Wagner
2016-09-02 12:37 ` [PATCH v5 3/4] tracing: Add trace_irqsoff tracepoints Binoy Jayan
2016-09-02 13:14 ` Steven Rostedt
2016-09-02 12:37 ` [PATCH v5 4/4] tracing: Histogram for delayed hrtimer offsets Binoy Jayan
2016-09-02 13:20 ` 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=20160902090952.7abb5324@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=arnd@arndb.de \
--cc=binoy.jayan@linaro.org \
--cc=daniel.wagner@bmw-carit.de \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu@linaro.org \
--cc=mingo@redhat.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
all inboxes | Powered by JetHome®