Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

figure out how long a job takes to complete

Status
Not open for further replies.

pry

Technical User
Mar 12, 2002
9
US
I will be doing some volume testing on an AIX computer. I would like to write a script, that will tell me the start and end times of a program. (I really only need the end time, I'll be starting the program, I'll know that time!)I need to write the script as a regular user, I won't have access to crontab. I'm thinking of something like this:

find the pnum of the program
while ps|grep pnum
do
date > lasttime
done


then, the lasttime file will contain the time just before the program ended.. am I figuring this our right? Any help would be appreciated,,

thanks
James

ps - Korn shell is the default
 
Start the program with a shell, something like...

#!/usr/bin/ksh
. /yourprogramhere
date >> lastime
exit

This will time/date stamp everytime you run the script for testing after your program finishes.

Off to grap another cup...
[morning] needcoffee
 
PHV's example will give you the elapsed time, time charged to user and time charged to sytem in seconds in the format:
real 10.5
user 0.3
sys 3.5

If you want to be thorough in your testing try:

#!usr/bin/ksh
date >> lasttime.log
/usr/bin/time /yourprogramhere 2>> lasttime.log
date >> lasttime.log

This will give you the start time, system times from the time command, and end time for your program.

[morning] needcoffee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top