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.

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.

Any other ideas?

Dan.

> 
> On Tue, Dec 04, 2001, Dan Kenigsberg wrote about "[Slightly Off Topic] processor 
>speed":
> > I would like to tell the speed of the processor I'm using, via a system call, on
> >...
> > Please assume I cannot open the computer or afraid of screwdrivers, 
> > and cannot parse the lovely Linux /proc/cpuinfo, nor parse the output of Sun's
> 
> I'll answer only about Linux (I don't remember how to do this on Solaris).
> 
> On Linux, it is an "official" decision that instead of having dozens of system
> calls, or weird non-standard system calls returning even weirder data
> structures, or weird special kernel interfaces ("routing sockets" anyone?)
> that simple kernel information like that will only be available through
> the /proc/cpuinfo interface. What's wrong with that - how hard is to open
> this file and look for a newline followed by "cpu MHz"?
> The format of this file might changed in some future Linux release (the
> linux-kernel mailing list is always filled with fights on how to change /proc),
> but CPU speed is very non-portable anyway, so I don't see what problems this
> can cause you.
> 
> Of course, it's possible to access the CPU directly and find the CPU's
> version string, but this is definitely not recommended (if at all possible)
> to do outside the kernel. Check the Linux kernel on how they do it, if you're
> interested.
> 
> P.S. Obviously, with today's complicated CPUs, it is not at all certain how
> exactly the MHz or bogomips figures in /proc/cpuinfo are relevant to the
> "speed" of an actual program that you intend to run...
> 

=================================================================
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