diff options
author | Michal Simek <monstr@monstr.eu> | 2010-04-16 03:50:13 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2010-08-04 04:22:35 -0400 |
commit | 6f34b08f58f5097bb408e188e09cda75e61ee513 (patch) | |
tree | 141296e498aeffcf9f3fda777c93a7dc84dae8f5 /arch/microblaze/kernel/timer.c | |
parent | ce3266c047389443d5f433d605c769e878cbe46e (diff) |
microblaze: Improve ftrace time measuring
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>
Diffstat (limited to 'arch/microblaze/kernel/timer.c')
-rw-r--r-- | arch/microblaze/kernel/timer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index ed61b2f17719..22e296eb871b 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c | |||
@@ -235,6 +235,12 @@ static int __init microblaze_clocksource_init(void) | |||
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | 237 | ||
238 | /* | ||
239 | * We have to protect accesses before timer initialization | ||
240 | * and return 0 for sched_clock function below. | ||
241 | */ | ||
242 | static int timer_initialized; | ||
243 | |||
238 | void __init time_init(void) | 244 | void __init time_init(void) |
239 | { | 245 | { |
240 | u32 irq, i = 0; | 246 | u32 irq, i = 0; |
@@ -289,4 +295,15 @@ void __init time_init(void) | |||
289 | #endif | 295 | #endif |
290 | microblaze_clocksource_init(); | 296 | microblaze_clocksource_init(); |
291 | microblaze_clockevent_init(); | 297 | microblaze_clockevent_init(); |
298 | timer_initialized = 1; | ||
299 | } | ||
300 | |||
301 | unsigned long long notrace sched_clock(void) | ||
302 | { | ||
303 | if (timer_initialized) { | ||
304 | struct clocksource *cs = &clocksource_microblaze; | ||
305 | cycle_t cyc = cs->read(NULL); | ||
306 | return clocksource_cyc2ns(cyc, cs->mult, cs->shift); | ||
307 | } | ||
308 | return 0; | ||
292 | } | 309 | } |