linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane.
@ 2007-06-19  6:35 Tony Breeds
  2007-06-19  6:43 ` Segher Boessenkool
  2007-06-19 14:53 ` Olof Johansson
  0 siblings, 2 replies; 10+ messages in thread
From: Tony Breeds @ 2007-06-19  6:35 UTC (permalink / raw)
  To: LinuxPPC-dev

When booting a current kernel with CONFIG_PRINTK_TIME enabled you'll
see messages like:

[    0.000000] time_init: decrementer frequency = 188.044000 MHz
[    0.000000] time_init: processor frequency   = 1504.352000 MHz
[3712914.436297] Console: colour dummy device 80x25

This patch modifies sched_clock() to report the offset since the machine booted
so the same printk's now look like:

[    0.000000] time_init: decrementer frequency = 188.044000 MHz
[    0.000000] time_init: processor frequency   = 1504.352000 MHz
[    0.000135] Console: colour dummy device 80x25

Effectivly including the uptime in printk()s.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>

---

 arch/powerpc/kernel/time.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: working/arch/powerpc/kernel/time.c
===================================================================
--- working.orig/arch/powerpc/kernel/time.c
+++ working/arch/powerpc/kernel/time.c
@@ -115,6 +115,7 @@ EXPORT_SYMBOL_GPL(rtc_lock);
 
 u64 tb_to_ns_scale;
 unsigned tb_to_ns_shift;
+unsigned long boot_tb;
 
 struct gettimeofday_struct do_gtod;
 
@@ -735,7 +736,7 @@ unsigned long long sched_clock(void)
 {
 	if (__USE_RTC())
 		return get_rtc();
-	return mulhdu(get_tb(), tb_to_ns_scale) << tb_to_ns_shift;
+	return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;
 }
 
 int do_settimeofday(struct timespec *tv)
@@ -960,6 +961,8 @@ void __init time_init(void)
 	}
 	tb_to_ns_scale = scale;
 	tb_to_ns_shift = shift;
+	/* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
+	boot_tb = get_tb();
 
 	tm = get_boot_time();
 
Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

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

end of thread, other threads:[~2007-06-21  4:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-19  6:35 [PATCH/RFC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane Tony Breeds
2007-06-19  6:43 ` Segher Boessenkool
2007-06-19 14:53 ` Olof Johansson
2007-06-20  2:02   ` Tony Breeds
2007-06-20  2:27     ` Olof Johansson
2007-06-20  3:13     ` [PATCH/RFC] Make certain timekeeping variables __read_mostly Tony Breeds
2007-06-20  7:41       ` Geert Uytterhoeven
2007-06-21  4:41         ` Tony Breeds
2007-06-20  7:37     ` [PATCH/RFC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane Geert Uytterhoeven
2007-06-21  4:29       ` Tony Breeds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).