[LinuxBIOS] Is there sched_clock equivalent in LB?
Eric Poulsen
eric at zyxod.com
Thu Apr 27 05:37:06 CEST 2006
Daniel Parthey wrote:
>Eric Poulsen schrieb:
>
>
>>I was going to hack LB a bit, and add a timestamp, just like you see in
>>the newer Linux kernels, to look for potential bottlenecks specific to
>>my MLB. The kernel printk uses sched_clock() to get the current time.
>>Is there an equivalent call in LB? I've looked through the code base
>>for files / code that has *clock* or *time* or something similar, but
>>without much luck.
>>
>>
>
>I suppose MLB means VIA EPIA ML Board?
>
>
I had meant Main Logic Board, but I guess it works both ways.
>On Intel compatible Pentium (or higher) boards like VIA EPIA, you could
>read the Time Stamp Counter (TSC) CPU register which tells you the number
>of cycles from the last machine reset. Use the "cpuid" assembler command
>as a barrier (to prevent out-of-order command execution) in combination
>with the "rdtsc" assembler command to read the time time stamp counter.
>The linux kernel sourcecode contains examples for this.
>
>
My Intel assembly is 15 years rusty -- I'd have better luck doing this
on a PIC. My co-worker hacks Intel assembly -- I'll get him to help me.
>If you manage to get some inline assembler code into linuxbios,
>you could take two time stamp counter (TSC) values and store them somewhere.
>You can convert the number of ticks into real time units afterwards,
>you could either use the processor speed from /proc/cpuinfo or determine
>the number of processor cycles per second on your processor yourself.
>Disable automatic CPU clock adjust to have the CPU run at constant speed.
>
>bye,
>Daniel.
>
>
More information about the coreboot
mailing list