public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] fix printk format typo in boot ftracer.
@ 2008-10-04 20:42 Arjan van de Ven
  2008-10-04 20:58 ` Frédéric Weisbecker
  0 siblings, 1 reply; 5+ messages in thread
From: Arjan van de Ven @ 2008-10-04 20:42 UTC (permalink / raw)
  To: Frédéric Weisbecker, mingo; +Cc: linux-kernel

When printing nanoseconds, the right printk format string is %09 not %06...

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>

diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index a7efe35..d0a5e50 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -62,14 +62,14 @@ static enum print_line_t initcall_print_line(struct trace_iterator *iter)
 	struct timespec rettime = ktime_to_timespec(it->rettime);
 
 	if (entry->type == TRACE_BOOT) {
-		ret = trace_seq_printf(s, "[%5ld.%06ld] calling  %s @ %i\n",
+		ret = trace_seq_printf(s, "[%5ld.%09ld] calling  %s @ %i\n",
 					  calltime.tv_sec,
 					  calltime.tv_nsec,
 					  it->func, it->caller);
 		if (!ret)
 			return TRACE_TYPE_PARTIAL_LINE;
 
-		ret = trace_seq_printf(s, "[%5ld.%06ld] initcall %s "
+		ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s "
 					  "returned %d after %lld msecs\n",
 					  rettime.tv_sec,
 					  rettime.tv_nsec,

-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch] fix printk format typo in boot ftracer.
  2008-10-04 20:42 [patch] fix printk format typo in boot ftracer Arjan van de Ven
@ 2008-10-04 20:58 ` Frédéric Weisbecker
  2008-10-05  0:24   ` Arjan van de Ven
  0 siblings, 1 reply; 5+ messages in thread
From: Frédéric Weisbecker @ 2008-10-04 20:58 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: mingo, linux-kernel

2008/10/4 Arjan van de Ven <arjan@infradead.org>:
> When printing nanoseconds, the right printk format string is %09 not %06...
>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
>
> diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
> index a7efe35..d0a5e50 100644
> --- a/kernel/trace/trace_boot.c
> +++ b/kernel/trace/trace_boot.c
> @@ -62,14 +62,14 @@ static enum print_line_t initcall_print_line(struct trace_iterator *iter)
>        struct timespec rettime = ktime_to_timespec(it->rettime);
>
>        if (entry->type == TRACE_BOOT) {
> -               ret = trace_seq_printf(s, "[%5ld.%06ld] calling  %s @ %i\n",
> +               ret = trace_seq_printf(s, "[%5ld.%09ld] calling  %s @ %i\n",
>                                          calltime.tv_sec,
>                                          calltime.tv_nsec,
>                                          it->func, it->caller);
>                if (!ret)
>                        return TRACE_TYPE_PARTIAL_LINE;
>
> -               ret = trace_seq_printf(s, "[%5ld.%06ld] initcall %s "
> +               ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s "
>                                          "returned %d after %lld msecs\n",
>                                          rettime.tv_sec,
>                                          rettime.tv_nsec,

I picked these formats from the printk.c time formatting. But you're right,
09 would give us the whole nano precision.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] fix printk format typo in boot ftracer.
  2008-10-04 20:58 ` Frédéric Weisbecker
@ 2008-10-05  0:24   ` Arjan van de Ven
  2008-10-05  9:51     ` Ingo Molnar
  2008-10-05 11:36     ` Frédéric Weisbecker
  0 siblings, 2 replies; 5+ messages in thread
From: Arjan van de Ven @ 2008-10-05  0:24 UTC (permalink / raw)
  To: Frédéric Weisbecker; +Cc: mingo, linux-kernel

On Sat, 4 Oct 2008 22:58:12 +0200
"Frédéric Weisbecker" <fweisbec@gmail.com> wrote:

> > -               ret = trace_seq_printf(s, "[%5ld.%06ld] initcall %s
> > "
> > +               ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s
> > " "returned %d after %lld msecs\n",
> >                                          rettime.tv_sec,
> >                                          rettime.tv_nsec,
> 
> I picked these formats from the printk.c time formatting. But you're
> right, 09 would give us the whole nano precision.

it's more than precision, it's correctness.

doing "0.%02i" will do
0.100  if you pass it 100 and
0.10   if you pass it 10

and most off the time, except the first 0.1 seconds, you'll be passing
it 9 digits, but the first 0.1 seconds.. the %06 will just give really
incorrect results.



-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] fix printk format typo in boot ftracer.
  2008-10-05  0:24   ` Arjan van de Ven
@ 2008-10-05  9:51     ` Ingo Molnar
  2008-10-05 11:36     ` Frédéric Weisbecker
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-10-05  9:51 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: Frédéric Weisbecker, linux-kernel


* Arjan van de Ven <arjan@infradead.org> wrote:

> On Sat, 4 Oct 2008 22:58:12 +0200
> "Frédéric Weisbecker" <fweisbec@gmail.com> wrote:
> 
> > > -               ret = trace_seq_printf(s, "[%5ld.%06ld] initcall %s
> > > "
> > > +               ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s
> > > " "returned %d after %lld msecs\n",
> > >                                          rettime.tv_sec,
> > >                                          rettime.tv_nsec,
> > 
> > I picked these formats from the printk.c time formatting. But you're
> > right, 09 would give us the whole nano precision.
> 
> it's more than precision, it's correctness.
> 
> doing "0.%02i" will do
> 0.100  if you pass it 100 and
> 0.10   if you pass it 10
> 
> and most off the time, except the first 0.1 seconds, you'll be passing
> it 9 digits, but the first 0.1 seconds.. the %06 will just give really
> incorrect results.

applied to tip/tracing/core, thanks!

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] fix printk format typo in boot ftracer.
  2008-10-05  0:24   ` Arjan van de Ven
  2008-10-05  9:51     ` Ingo Molnar
@ 2008-10-05 11:36     ` Frédéric Weisbecker
  1 sibling, 0 replies; 5+ messages in thread
From: Frédéric Weisbecker @ 2008-10-05 11:36 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: mingo, linux-kernel

2008/10/5 Arjan van de Ven <arjan@infradead.org>:
> it's more than precision, it's correctness.
>
> doing "0.%02i" will do
> 0.100  if you pass it 100 and
> 0.10   if you pass it 10
>
> and most off the time, except the first 0.1 seconds, you'll be passing
> it 9 digits, but the first 0.1 seconds.. the %06 will just give really
> incorrect results.

That's right indeed.

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-05 11:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-04 20:42 [patch] fix printk format typo in boot ftracer Arjan van de Ven
2008-10-04 20:58 ` Frédéric Weisbecker
2008-10-05  0:24   ` Arjan van de Ven
2008-10-05  9:51     ` Ingo Molnar
2008-10-05 11:36     ` Frédéric Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox