Skip to contentSkip to conversation

timer_list should use signed numbers for relative times

PATCH In review Pavel Machek 2 participants 5 messages Nov 27, 2007 High-resolution timers, timer wheel, clockevents

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 timer_list should use signed numbers for relative times

Relative times are signed by nature, and timers can (briefly) have expires in past. Print them as negative numbers.

kernel/time/timer_list.c +1 -1
index 12c5f4c..7f6eaa9 100644
@@ -65,7 +65,7 @@ #ifdef CONFIG_TIMER_STATS
 	SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
 #endif
 	SEQ_printf(m, "\n");
-	SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n",
+	SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
 		(unsigned long long)ktime_to_ns(timer->expires),
 		(unsigned long long)(ktime_to_ns(timer->expires) - now));
 }
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw
Quoted 10 lines · Pavel Machek

Relative times are signed by nature, and timers can (briefly) have expires in past. Print them as negative numbers.

kernel/time/timer_list.c +0 -0
index 12c5f4c..7f6eaa9 100644

kernel/time/timer_list.c #ifdef CONFIG_TIMER_STATS · line 70

Quoted 7 lines
kernel/time/timer_list.c +1 -1
@@ -65,7 +65,7 @@ #ifdef CONFIG_TIMER_STATS
 	SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
 #endif
 	SEQ_printf(m, "\n");
-	SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n",
+	SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
 		(unsigned long long)ktime_to_ns(timer->expires),
 		(unsigned long long)(ktime_to_ns(timer->expires) - now));

Perhaps change the cast as well.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#2 lore raw

Hi!

Quoted 5 lines
Quoted 5 lines

Relative times are signed by nature, and timers can (briefly) have expires in past. Print them as negative numbers.

Quoted 14 lines

kernel/time/timer_list.c #ifdef CONFIG_TIMER_STATS · line 70

Quoted 12 lines
kernel/time/timer_list.c +1 -1
index 12c5f4c..7f6eaa9 100644
@@ -65,7 +65,7 @@ #ifdef CONFIG_TIMER_STATS
 	SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
 #endif
 	SEQ_printf(m, "\n");
-	SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n",
+	SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
 		(unsigned long long)ktime_to_ns(timer->expires),
 		(unsigned long long)(ktime_to_ns(timer->expires) - now));

Perhaps change the cast as well.

Well, that seems to be absolute time, so %Lu makes some sense...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
Quoted 23 lines · Pavel Machek

Hi!

Quoted 5 lines
Quoted 5 lines

Relative times are signed by nature, and timers can (briefly) have expires in past. Print them as negative numbers.

Quoted 14 lines

kernel/time/timer_list.c #ifdef CONFIG_TIMER_STATS · line 70

Quoted 12 lines
kernel/time/timer_list.c +1 -1
index 12c5f4c..7f6eaa9 100644
@@ -65,7 +65,7 @@ #ifdef CONFIG_TIMER_STATS
 	SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
 #endif
 	SEQ_printf(m, "\n");
-	SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n",
+	SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
 		(unsigned long long)ktime_to_ns(timer->expires),
 		(unsigned long long)(ktime_to_ns(timer->expires) - now));

Perhaps change the cast as well.

Quoted 1 line

Well, that seems to be absolute time, so %Lu makes some sense...

I don't understand what this has to do with the cast.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#4 lore raw
Quoted 25 lines · Andreas Schwab
Quoted 23 lines · Pavel Machek

Hi!

Quoted 19 lines
Quoted 10 lines

Relative times are signed by nature, and timers can (briefly) have expires in past. Print them as negative numbers.

kernel/time/timer_list.c +0 -0
index 12c5f4c..7f6eaa9 100644

kernel/time/timer_list.c #ifdef CONFIG_TIMER_STATS · line 70

Quoted 7 lines
kernel/time/timer_list.c +1 -1
@@ -65,7 +65,7 @@ #ifdef CONFIG_TIMER_STATS
 	SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
 #endif
 	SEQ_printf(m, "\n");
-	SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n",
+	SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
 		(unsigned long long)ktime_to_ns(timer->expires),
 		(unsigned long long)(ktime_to_ns(timer->expires) - now));

Perhaps change the cast as well.

Quoted 3 lines
Quoted 1 line

Well, that seems to be absolute time, so %Lu makes some sense...

I don't understand what this has to do with the cast.

Aha, stupid me, yes, you are right, fixed.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html