How to get cpu time?

How to get cpu time?

Post by 288clif.. » Fri, 11 Mar 1994 21:08:51




> I am trying to benchmark a program and would like to know how to find the cpu
> time use by the program.  I know about the c shell time command, but I am not
> very sure what is user time and system time.  If I am not wrong, user time is
> the time the cpu does i/o and system time is the time instruction go into the
> processor.  Can anyone confirm it ?

System time: CPU time spent on kernel calls.
User time: CPU time spent on user functions (most will include some of above).

Quote:> BTW can anyone tell me exactly what is meant by the cpu time seen in scientific
> journal?  I like to know how the program we developed compared with other people
> Has anyone done anything like this before  care to comment?  

> Thanks
> Kai

> p.s. I have two programs doing the same things (different algorithm) but one
> of them is a commerial program so I do not have the source code.

You can use calls like getrusage() or gettimeofday() to time functions, but
note that these are built with the exectable i.e. included in the source.
Without source you are limited to using the time command. Also, profiling
tools can be helpfull, again this is a compile time monitor. Try >man prof;
man 2 getrusage; man 2 gettimeofday.

/d
--

 
 
 

How to get cpu time?

Post by KA » Sat, 12 Mar 1994 03:45:00


I am trying to benchmark a program and would like to know how to find the cpu
time use by the program.  I know about the c shell time command, but I am not
very sure what is user time and system time.  If I am not wrong, user time is
the time the cpu does i/o and system time is the time instruction go into the
processor.  Can anyone confirm it ?

BTW can anyone tell me exactly what is meant by the cpu time seen in scientific
journal?  I like to know how the program we developed compared with other people
Has anyone done anything like this before  care to comment?  

Thanks
Kai

p.s. I have two programs doing the same things (different algorithm) but one
of them is a commerial program so I do not have the source code.