1833016 Members
3116 Online
110048 Solutions
New Discussion

gtime vs date utility

 
Chern Jian Leaw
Regular Advisor

gtime vs date utility

HI,

I would like to time the duration of the rcp process invoked. I did the following:

#gtime rcp host1:/home/cs/joe /home/cadeng/joe
0.00user 0.01 system 0:00.02 elapsed 41%CPU(0avgtext + 0avgdata 0maxresident)k oinputs+0outputs (92major + 10minor) pagefaults 0swaps

Could someone help me interpret the results? I've not used gtime before, but came across this utility over the web, without explanations about the output.

I would like to know more on the portion of gtime's output below:
0.00user 0.01 system 0:00.02 elapsed 41%CPU

what is the difference in using date vs. gtime utilities to measure the duration taken for a process?

Thanks.
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: gtime vs date utility

"0.00user 0.01 system 0:00.02 elapsed 41%CPU"
is telling you that the total elapsed time was 2 seconds, one of which was system overhead, the other was probably user but slightly less than one second. The process also used 41% of the CPU.

HTH,
Pete

Pete
Chern Jian Leaw
Regular Advisor

Re: gtime vs date utility

Pete,
In the elapsed time that you're referring, are you referring about the elapsed time between the user's invocation of the command with the system's time taken to execute the commmand?

I seem to see some math relationship in the output portion of :
0.00user 0.01 system 0:00.02 elapsed 41%CPU

but I'm still unable to determine it.

Could you further elaborate? I can't find any man pages on gtime on my machines, nor on the web.

Thanks.
steven Burgess_2
Honored Contributor

Re: gtime vs date utility

Hi Chern

I would interpret that as being

The overall time the system took to complete the command when the command was invoked by the system. Not the time taken for the box name to be resolved and the connection made before the command execution

%CPU - Be it how much CPU was used when the command was executed. This would be different depending on when you run the command and how busy the system is at that time

Hope this helps

Steve
take your time and think things through
Chern Jian Leaw
Regular Advisor

Re: gtime vs date utility

Steve,

Is gtime measured in seconds? Hence 0.02system would be interpreted as taking 0.02 seconds of the system time, or just 2 seconds of the system time?

I experimented with gtime for the rcp process again, and I obtained the results below:

0.01user 0.02system 0:04.25elapsed 0%CPU (0avgtext + 0avgdata 0maxresident)k 0inputs+6outputs (6 major + 418minor) pagefaults 0 swaps

How is it possible that the elapsed time is so much greater than the total of user+system time? Is 0:04.25 measured as 4 seconds, 25 mil seconds??

Kindly clarify.
Frank Slootweg
Honored Contributor

Re: gtime vs date utility

You may want to use the standard HP-UX/UNIX commands time(1) and timex(1) instead of qtime. That way you have documentation and everybody knows what is what.

As to "elapsed" time, that is often called "wall clock time", i.e. how much time really elapsed (on the clock on the wall). time(1) and timex(1) call this "real" time.