- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- CPU time and elapsed time
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2002 10:40 AM
04-11-2002 10:40 AM
How do I find the time elapsed, CPU time taken for a child process. With timex I am getting real time, but how do I find the CPU time.
TIA
Kris
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2002 10:52 AM
04-11-2002 10:52 AM
Re: CPU time and elapsed time
If you know the Process ID (PID) - you can do:
#ps -ef | grep PID
And the TIME column will list cumulative execution time.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2002 11:02 AM
04-11-2002 11:02 AM
Re: CPU time and elapsed time
Use 'top' command. Check the "TIME" parameter, that will tell you the number of system and CPU seconds the process has consumed.
You can use Glanceplus too and check the process reports:
# gpm
HTH,
Shiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2002 11:10 AM
04-11-2002 11:10 AM
Re: CPU time and elapsed time
Of course both of these are "real-time" & not elapsed or after the fact times.
If you want those you'll need to install & activate Accounting & then use the acctcom command that searches the /var/adm/pacct file & grep for the command you ran & in here can be found (CPU secs) values.
See the acctcom docs:
http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90129/B2355-90129_top.html&con=/hpux/onlinedocs/B2355-90129/00/00/8-con.html&toc=/hpux/onlinedocs/B2355-90129/00/00/8-toc.html&searchterms=acctcom&queryid=20020411-121554
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2002 11:19 AM
04-11-2002 11:19 AM
Re: CPU time and elapsed time
Thanks for the suggestions. At the moment we haven't installed accounting software (our system engineer thinks it is very much overhead..), so I am trying to find other ways.
Here the example (only) of my case.
$ cat a.sh
#!/bin/sh
echo "xxxx"
sleep 60
$cat b.sh
#!/bin/sh
timex 2>rtime.log a.sh
The b.sh is submitted through cron, so I can't use top or ps -ef effectively.
Kris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2002 11:30 PM
04-11-2002 11:30 PM
Re: CPU time and elapsed time
Try:-
ps -ef | grep "scriptname" >/tmp/timerlog
Place this at secont to last line.
Run it and the cat the timerlog.
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2002 11:32 PM
04-11-2002 11:32 PM
Re: CPU time and elapsed time
To pick up the pid of your running programme,
within the program:-
runpid=`ps -ef | grep
echo $runpid
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2002 04:18 AM
04-12-2002 04:18 AM
SolutionSome examples:
$ # Hardly any CPU time, i.e. user and sys are (nearly) zero :
$ timex sleep 5
real 5.02
user 0.00
sys 0.01
$ # Nearly all CPU time, i.e. user + sys ~ real:
$ cat ./doit
#! /usr/bin/sh
count=0
while [ count -le 100000 ]
do
((count=count+1))
done
$ timex ./doit
real 8.44
user 5.95
sys 2.48
$