Skip to contentSkip to conversation

fix printk format typo in boot ftracer.

PATCH Applied Arjan van de Ven 3 participants 5 messages Oct 4, 2008 – Oct 5, 2008 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix printk format typo in boot ftracer.

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

kernel/trace/trace_boot.c +2 -2
index a7efe35..d0a5e50 100644
@@ -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,
Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#1 lore raw

2008/10/4 Arjan van de Ven <[email protected]>:

Quoted 15 lines

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

kernel/trace/trace_boot.c +1 -1
index a7efe35..d0a5e50 100644
@@ -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,

kernel/trace/trace_boot.c static enum print_line_t initcall_print_line(struct trace_iterator *iter) · line 75

Quoted 10 lines
kernel/trace/trace_boot.c +1 -1
                                         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.

#2 lore raw
Quoted 9 lines · On Sat, 4 Oct 2008 22:58:12 +0200 "Frédéric Weisbecker" <[email protected]>…
Quoted 6 lines

- 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.

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
Applied
#3 lore raw
Quoted 15 lines · Arjan van de Ven
Quoted 9 lines · On Sat, 4 Oct 2008 22:58:12 +0200 "Frédéric Weisbecker" <[email protected]>…
Quoted 6 lines

- 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.

Quoted 7 lines

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

#4 lore raw
In reply to Arjan van de Ven

2008/10/5 Arjan van de Ven <[email protected]>:

Quoted 9 lines

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!