Any way to get process statistics?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Any way to get process statistics?
# 1  
Old 05-30-2013
Any way to get process statistics?

Hi,

Can someone advise what "generic" command can I use to show statistics of a process or a running script/process?

For example, I want to know how many hours/minutes it's taken to run or has been running, how much CPU it used and how much memory it used or uses.

I want to be able to do run the command for both Solaris and Linux.

I found several suggestion on how long a process has been running by checking the timestamp in /proc and doing a calculation with the current time, but it does not show how to do time arithmetic Smilie

Any advice much appreciated. Thanks.
# 2  
Old 05-30-2013
Have you looked at the manual page for ps? That gives running process information, but obviously the end time is not recorded.

Alternatively, you could write your code to do some logging for you, for example, you can write a message to the system log with the logger command on most versions of unix. This is date/time stamped, so you can review it later.



I hope that this helps.


Robin
Liverpool/Blackburn
UK
# 3  
Old 05-30-2013
Posix style is best portable:
Code:
ps -eo pid,stime,etime,time,rss,vsz,user,args

If you know the pid and the user and the args (in this case $$ - the pid of the shell):
Code:
ps -p $$ -o etime,time,rss,vsz,comm

Without header:
Code:
ps -p $$ -o etime= -o time= -o rss= -o vsz= -o comm=

This User Gave Thanks to MadeInGermany For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

statistics using awk

Hi, I have 3 columns in a file listed below. X Y X/(X+Y) 1 1 0.5 1 1 0.5 4 1 0.8 1 1 0.5 6 1 0.857142857 1 1 0.5 23 1 0.958333333 Now I want to find confidence interval using the formula for each row. (p-2 sqrt p(1-p)/(x+y), p+2... (7 Replies)
Discussion started by: Diya123
7 Replies

2. AIX

Statistics Aix

Hello If there is a way to get a statistics from Aix box server from a month. cpu use, memory, disc use, etc. Maybe via smitty or I need to do a script. The os is Aix 5.3 Greetings (8 Replies)
Discussion started by: lo-lp-kl
8 Replies

3. HP-UX

packets statistics

Hi there, are there any functions that can get the packets statistics on UNIX ? thanks. (2 Replies)
Discussion started by: Frank2004
2 Replies

4. Solaris

how to get server statistics

Hello What commands can give following type of information about the server: Time: 20080331.12:10:39 Current CPU: 97.0% Current Memory: 3.7% Current Disk Space: 76% The resources on server is currently not available. Current CPU, Memory, or Disk Space is exceeding threshold Waiting for... (2 Replies)
Discussion started by: shalua
2 Replies

5. UNIX for Advanced & Expert Users

Getting Socket statistics

Is there any way to get the file descriptor statistics of a socket file descriptor? I know that the fstat, stat system calls are for this purpose, but I want to know it there any way to get socket connection statistics for a file descriptor(like socket flags, connection type etc). Does /proc... (3 Replies)
Discussion started by: comp_wizard07
3 Replies

6. UNIX for Dummies Questions & Answers

IO statistics of a solaris process

Hi, How to find the IO being consumed by a partciular Solaris process? A plain iostat only gives the IO statistics of the system/disk as a whole! Any help would be appreciated! (2 Replies)
Discussion started by: smanu
2 Replies

7. UNIX for Dummies Questions & Answers

file statistics??

Is there any command in Unix (HP-UX) which will give me the file statistics .. e.g I have a file called r001 if I created that file on 2nd of aug 2005 and till now I changed that file contents 10 times. So how will I get the history statistic(time & date) of file modification. (1 Reply)
Discussion started by: zing_foru
1 Replies

8. Shell Programming and Scripting

Analyze Statistics

I have a file which contains records in the format of 2006-08-25 12:06:13|ABC|93 2006-08-25 12:45:55|ABC|203 2006-08-25 01:48:19|DEF|156 2006-08-25 01:49:09|ABC|12798 2006-08-25 02:49:59|GHL|4109 2006-08-25 03:50:50|DEF|234 where the format is "arrive time"|"message type"|"processing... (3 Replies)
Discussion started by: mpang_
3 Replies

9. Programming

Server Statistics ?

I'm trying to write a C program to view server statistics such as: - server general information - CPU usage - memory usage - running processes Cany anybody gives me hints on those system calls ?? ps: I'm using Tru64 unix (6 Replies)
Discussion started by: Agent007
6 Replies
Login or Register to Ask a Question