[lkml]   [2009]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: How to use a different sched_clock() for ftrace on omap?
Tim Bird wrote:
> Hi all,
> I've worked up a replacement sched_clock for ftrace on my omap platform.
> The current sched_clock, based on the 32K timer, has low resolution and
> doesn't provide very useful results.
> Unfortunately, I'm not sure the best way to use my special one, in place
> of a common one in arch/arm/plat-omap/common.c
> I thought the __attribute__ ((weak)) would be enough to have the
> sched_clock() in common.c get out of the way, and allow my board-specific
> sched_clock() to be used. But that didn't work.

Not sure that will work correctly since sched_clock in kernel/sched.c is
already defined as weak. If you have two weak versions of a function I
think the one which gets used is based on link order (if your board's
sched_clock is not being used).

> What is the recommended
> way to specify a board-specific function at compile time?

You could look at arch/x86/kernel/tsc_32.c, I think it does what you
want by using the function called native_sched_clock for the default
sched_clock implementation and using the alias attribute if no board
specific implementation is given, ie:

unsigned long long sched_clock(void)
unsigned long long sched_clock(void)

You could make it more generic by have some_board_sched_clock be a
#define (__board_sched_clock or something), so if a board defines it
(will need to be in a platform wide header) then you use that, otherwise
you use native_sched_clock.


Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon Unit 5, Amuri Park
Phone: +64 3 3779127 404 Barbadoes St
Fax: +64 3 3779135 PO Box 13 889
Email: Christchurch, 8013
Web: New Zealand
Freecall Australia 1800 148 751 USA 1800 261 2934

 \ /
  Last update: 2009-05-07 02:45    [W:0.053 / U:26.748 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site