[LinuxBIOS] Is there sched_clock equivalent in LB?

Daniel Parthey pada at chemonline.de
Thu Apr 27 01:23:00 CEST 2006


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?

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.

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.
-- 
Jabber: pada at jabber.ccc.de




More information about the coreboot mailing list