[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141120063846.GD27177@byungchulpark-X58A-UD3R>
Date: Thu, 20 Nov 2014 15:38:46 +0900
From: Byungchul Park <byungchul.park@....com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>, mingo@...hat.com,
linux-kernel@...r.kernel.org, seungho1.park@....com,
jolsa@...hat.com
Subject: Re: [PATCH v5 2/2] tracing: add additional marks to signal very
large time
Hello,
On Thu, Nov 20, 2014 at 03:05:43PM +0900, Namhyung Kim wrote:
> Hi Steve and Byungchul,
>
> On Wed, 19 Nov 2014 20:06:04 -0500, Steven Rostedt wrote:
> > On Thu, 20 Nov 2014 09:15:35 +0900
> > byungchul.park@....com wrote:
> >> -static unsigned long preempt_mark_thresh_us = 100;
> >> +#undef MARK
> >> +#define MARK(v, s) {.val = v, .sym = s}
> >> +/* trace overhead mark */
> >> +static const struct trace_mark {
> >> + unsigned long long val; /* unit: nsec */
> >> + char sym;
> >> +} mark[] = {
> >> + MARK(1000000000ULL , '$'), /* 1 sec */
> >> + MARK(1000000ULL , '#'), /* 1000 usecs */
> >> + MARK(100000ULL , '!'), /* 100 usecs */
> >> + MARK(10000ULL , '+'), /* 10 usecs */
> >> + MARK(0ULL , ' '), /* 0 usecs */
> >> +};
> >> +#undef MARK
> >> +
> >> +char trace_find_mark(unsigned long long d)
> >> +{
> >> + int i;
> >> + int size = ARRAY_SIZE(mark);
> >> +
> >> + for (i = 0; i < size; i++) {
> >> + if (d >= mark[i].val)
> >> + break;
> >> + }
> >> +
> >> + return (i == size)? ' ' : mark[i].sym;
> >
> > Change this to:
> >
> > /* The break from loop must have been hit */
> > if (WARN_ON_ONCE(i == size))
> > return ' ';
>
> I think it's impossible since it's always true that 'd >= 0'.
>
If someone won't define "MARK(0ULL, ' ')", then i think it can happen. :)
Thanks,
Byungchul
> Thanks,
> Namhyung
>
> >
> > return mark[i].sym;
> >
> > -- Steve
> >
> >
> >> +}
> >>
> >> static int
> >> lat_print_timestamp(struct trace_iterator *iter, u64 next_ts)
> >> @@ -506,8 +532,7 @@ lat_print_timestamp(struct trace_iterator *iter, u64 next_ts)
> >> return trace_seq_printf(
> >> s, " %4lldus%c: ",
> >> abs_ts,
> >> - rel_ts > preempt_mark_thresh_us ? '!' :
> >> - rel_ts > 1 ? '+' : ' ');
> >> + trace_find_mark(rel_ts * NSEC_PER_USEC));
> >> } else { /* !verbose && !in_ns */
> >> return trace_seq_printf(s, " %4lld: ", abs_ts);
> >> }
> >> @@ -692,7 +717,7 @@ int register_ftrace_event(struct trace_event *event)
> >> goto out;
> >>
> >> } else {
> >> -
> >> +
> >> event->type = next_event_type++;
> >> list = &ftrace_event_list;
> >> }
> --
> 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/
--
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