]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
microblaze: Improve ftrace time measuring
authorMichal Simek <monstr@monstr.eu>
Fri, 16 Apr 2010 07:50:13 +0000 (09:50 +0200)
committerMichal Simek <monstr@monstr.eu>
Wed, 4 Aug 2010 08:22:35 +0000 (10:22 +0200)
I had to comment sched_clock generic function because of broken toolchain.
It is fine grain timing.

Signed-off-by: Michal Simek <monstr@monstr.eu>
arch/microblaze/include/asm/setup.h
arch/microblaze/kernel/timer.c

index 7f31394985e05f5884d6848ab902de53f8c45ac4..782b5c89248e1f5222a83192f1608ce110adedcc 100644 (file)
@@ -28,8 +28,6 @@ void disable_early_printk(void);
 void heartbeat(void);
 void setup_heartbeat(void);
 
-unsigned long long sched_clock(void);
-
 #   ifdef CONFIG_MMU
 extern void mmu_reset(void);
 extern void early_console_reg_tlb_alloc(unsigned int addr);
index ed61b2f177192e79921fae4e95092374309a3c0f..22e296eb871bd91e071eaacd2c388f66cdf1bece 100644 (file)
@@ -235,6 +235,12 @@ static int __init microblaze_clocksource_init(void)
        return 0;
 }
 
+/*
+ * We have to protect accesses before timer initialization
+ * and return 0 for sched_clock function below.
+ */
+static int timer_initialized;
+
 void __init time_init(void)
 {
        u32 irq, i = 0;
@@ -289,4 +295,15 @@ void __init time_init(void)
 #endif
        microblaze_clocksource_init();
        microblaze_clockevent_init();
+       timer_initialized = 1;
+}
+
+unsigned long long notrace sched_clock(void)
+{
+       if (timer_initialized) {
+               struct clocksource *cs = &clocksource_microblaze;
+               cycle_t cyc = cs->read(NULL);
+               return clocksource_cyc2ns(cyc, cs->mult, cs->shift);
+       }
+       return 0;
 }