[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141117081940.667ee391@gandalf.local.home>
Date: Mon, 17 Nov 2014 08:19:40 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: byungchul.park@....com
Cc: mingo@...hat.com, linux-kernel@...r.kernel.org,
seungho1.park@....com, jolsa@...hat.com
Subject: Re: [PATCH v3 2/3] tracing, function_graph: add additional marks to
signal very large function execution time
On Mon, 17 Nov 2014 09:41:57 +0900
byungchul.park@....com wrote:
> From: Byungchul Park <byungchul.park@....com>
>
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index 385391f..d89868a 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -331,6 +331,25 @@ struct tracer_flags {
> /* Makes more easy to define a tracer opt */
> #define TRACER_OPT(s, b) .name = #s, .bit = b
>
> +/* trace overhead mark */
> +struct trace_mark {
> + unsigned long long val; /* unit: nsec */
> + char sym;
> +};
> +
> +#define MARK(v, s) {.val = v, .sym = s}
> +
> +static inline char trace_duration_mark(unsigned long long d,
> + const struct trace_mark m[],
> + int size)
> +{
> + int idx = size;
> +
> + if (size <= 0) return ' ';
> + while (d <= m[--idx].val && idx > 0);
> +
> + return m[idx].sym;
> +}
>
> /**
> * struct tracer - a specific tracer and its callbacks to interact with debugfs
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index cb33f46..d9ac09f 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -797,6 +797,19 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
> return TRACE_TYPE_HANDLED;
> }
Move the #define MARK() down to here (just before it is used). And add
a "#undef MARK" before it. You never know if some header file might
include a #define MARK somewhere.
>
> +static const struct trace_mark mark[] = {
> + MARK(0ULL , ' '), /* 0 usecs */
> + MARK(10000ULL , '+'), /* 10 usecs */
> + MARK(100000ULL , '!'), /* 100 usecs */
> + MARK(1000000ULL , '#'), /* 1000 usecs */
> + MARK(1000000000ULL , '$'), /* 1 sec */
> +};
You can add a "#undef MARK" here too, just to let people know that you
are done with it. But this one is optional.
Thanks!
-- Steve
> +
> +static inline char find_trace_mark(unsigned long long d)
> +{
> + return trace_duration_mark(d, mark, ARRAY_SIZE(mark));
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists