On Wed, 5 Dec 2001, Dan Kenigsberg wrote:

> I admit this is slightly "Meaningless Numbers Calculus", but I have
> to measure a certain computational task, and come up with a number
> per architecture. I could use total process time, but dividing it
> with the processor speed to acquire a measure of total cpu cycles
> seems more appropriate.

as for process time, you can use getrusage() to get the total user time
and system time.

> Returning to my problem, I can use /proc/cpuinfo (in fact, I am).
> However, on Sun/Alpha the best I can do is run psrinfo, but it is
> problematic since those systems are in some cases assymetric - and I cannot tell
> on which cpu my proccess is running.

use inline asm to get cpu speed? i would think that all cpus have an
instruction to get this information. you can look at the kernel's arch/
subdir to see how it's calculated for the different architectures. note
that this is most likely a can of worms, unless you only need to support
a limited subset of processors architectures.
-- 
mulix

http://www.pointer.co.il/~mulix/
http://syscalltrack.sf.net/



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to