lkml.org 
[lkml]   [2014]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 2/2] tracing: add additional marks to signal very large time
On Thu, 20 Nov 2014 15:05:43 +0900
Namhyung Kim <namhyung@kernel.org> 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@lge.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'.
>

It is impossible if this code never changes. But we all know that
wont be the case :-)

-- Steve



\
 
 \ /
  Last update: 2014-11-20 15:21    [W:1.756 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site