LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-07-2005, 05:26 PM   #1
TrulyTessa
Member
 
Registered: Nov 2004
Location: Canada, eh
Distribution: SuSE 9.2 Pro
Posts: 63

Rep: Reputation: 15
ps doesn't report time


When I use the command ps, my machine never tells me how long a process has been running. Instead it always returns 00:00:00.

For example:

PID TTY TIME CMD
18927 pts/4 00:00:00 bash
18960 pts/4 00:00:00 sas
20187 pts/4 00:00:00 ps

If I run ps -eaf I get tons more info, but still not an accurate value for time. For example:

UID PID PPID C STIME TTY TIME CMD
root 5590 5589 0 13:32 pts/3 00:00:00 bash
root 18856 8351 0 17:09 pts/2 00:00:00 su
root 18857 18856 0 17:09 pts/2 00:00:00 bash

I can see when a process started in the STIME field in the second example, but why isn't the TIME field correct in either case?

Many thanks.
 
Old 01-07-2005, 08:37 PM   #2
itsjustme
Senior Member
 
Registered: Mar 2003
Location: Earth
Distribution: Slackware, Ubuntu, Smoothwall
Posts: 1,571

Rep: Reputation: 47
Maybe the things you are looking at are so fast... they don't register time...
Here's ps -eaf on my slackware system:
Code:
bash-3.00$ ps -eaf
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jan04 ?        00:00:04 init [3]  
root         2     1  0 Jan04 ?        00:00:00 [keventd]
root         3     1  0 Jan04 ?        00:00:00 [ksoftirqd_CPU0]
root         4     1  0 Jan04 ?        00:00:00 [kswapd]
root         5     1  0 Jan04 ?        00:00:00 [bdflush]
root         6     1  0 Jan04 ?        00:00:00 [kupdated]
root        10     1  0 Jan04 ?        00:00:00 [mdrecoveryd]
root        11     1  0 Jan04 ?        00:00:00 [kreiserfsd]
root        63     1  0 Jan04 ?        00:00:00 /usr/sbin/syslogd
root        66     1  0 Jan04 ?        00:00:00 /usr/sbin/klogd -c 3 -x
root       237     1  0 Jan04 ?        00:00:00 [khubd]
root       430     1  0 Jan04 ?        00:00:00 /sbin/dhcpcd -d -t 10 eth0
root      1448     1  0 Jan04 ?        00:00:00 /usr/sbin/inetd
root      1452     1  0 Jan04 ?        00:00:00 /usr/sbin/sshd
root      1470     1  0 Jan04 ?        00:00:00 /usr/sbin/cupsd
root      1492     1  0 Jan04 ?        00:00:00 /usr/sbin/crond -l10
daemon    1494     1  0 Jan04 ?        00:00:00 /usr/sbin/atd -b 15 -l 1
root      1503     1  0 Jan04 ?        00:00:00 /usr/sbin/smbd -D
root      1505  1503  0 Jan04 ?        00:00:00 /usr/sbin/smbd -D
root      1506     1  0 Jan04 ?        00:00:00 /usr/sbin/nmbd -D
root      1508     1  0 Jan04 ?        00:00:00 /usr/sbin/gpm -m /dev/mouse -t imps2
bs        1510     1  0 Jan04 tty1     00:00:00 -bash
root      1511     1  0 Jan04 tty2     00:00:00 /sbin/agetty 38400 tty2 linux
root      1512     1  0 Jan04 tty3     00:00:00 /sbin/agetty 38400 tty3 linux
root      1513     1  0 Jan04 tty4     00:00:00 /sbin/agetty 38400 tty4 linux
root      1514     1  0 Jan04 tty5     00:00:00 /sbin/agetty 38400 tty5 linux
root      1515     1  0 Jan04 tty6     00:00:00 /sbin/agetty 38400 tty6 linux
bs        1863  1510  0 Jan04 tty1     00:00:00 /bin/sh /usr/X11R6/bin/startx
bs        1875  1863  0 Jan04 tty1     00:00:00 xinit /home/bs/.xinitrc --
root      1876  1875  0 Jan04 ?        00:06:27 X :0
bs        1881  1875  0 Jan04 tty1     00:00:03 /usr/X11R6/bin/fluxbox
bs        1886  1881  0 Jan04 ?        00:00:00 rxvt
bs        1887  1886  0 Jan04 pts/0    00:00:00 bash
bs        1987  1881  0 Jan04 ?        00:00:00 rxvt
bs        1988  1987  0 Jan04 pts/1    00:00:00 bash
bs        2011  1881  0 Jan04 ?        00:00:00 rxvt
bs        2012  2011  0 Jan04 pts/2    00:00:00 bash
bs        2082  1988  0 Jan04 pts/1    00:00:00 wmclock
bs        2790     1  0 Jan05 ?        00:00:01 /opt/kde/bin/artsd -F 10 -S 4096 -s 60 -m artsmessage -l 3 -
bs        3938  2012  0 19:29 pts/2    00:00:00 ps -eaf
Notice it's mostly zeros, but some stuff has time.

(Edited to add bold tags.)

Last edited by itsjustme; 01-10-2005 at 04:57 PM.
 
Old 01-07-2005, 10:34 PM   #3
TrulyTessa
Member
 
Registered: Nov 2004
Location: Canada, eh
Distribution: SuSE 9.2 Pro
Posts: 63

Original Poster
Rep: Reputation: 15
Glad to know I'm not the only one but how do I get the command to report time? I am accustomed to using time on unix machines to monitor the progress of my sas jobs, and I'm puzzled why I can't do the same on a linux machine. I know my new machine is fast, but c'mon!
 
Old 01-10-2005, 12:23 PM   #4
TrulyTessa
Member
 
Registered: Nov 2004
Location: Canada, eh
Distribution: SuSE 9.2 Pro
Posts: 63

Original Poster
Rep: Reputation: 15
bump
 
Old 01-10-2005, 03:35 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Try the command: top
 
Old 01-10-2005, 04:50 PM   #6
bulliver
Senior Member
 
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,764
Blog Entries: 4

Rep: Reputation: 78
You can also try:
Code:
# time command
Where command is the name of a command that you wish to see how long it runs...
Note that if the command takes less than a hundredth of a second (which is actually a lot of them with these fast shiny new boxes we have these days) it will be reported as 00:00:00

Also note that the time in ps eaf is _not_ chronological time...it is cpu time (ie amount of time the cpu used to run the command)
 
Old 01-10-2005, 05:23 PM   #7
TrulyTessa
Member
 
Registered: Nov 2004
Location: Canada, eh
Distribution: SuSE 9.2 Pro
Posts: 63

Original Poster
Rep: Reputation: 15
Thanks for the suggestions.

time command won't work, because I'm trying to see how much CPU time a particular job that has been running for several days taken; I'm not interested in seeing how long some generic command takes to execute. (I started a SAS job several days ago, and one of the ways I'd like to monitor its progress is to see how much CPU time it has taken.)

top doesn't seem to work either. The job I started several days ago shows up with time of 00:00:01. The job in question has already produced so much output that I can attest that it has used FAR more than 1 second of CPU time.

HMM:

It's strange, because in the time it took me to write this message, the top program itself is logging as having a time (in top) of 00:00:82, far more CPU time than the long-running SAS job. Failure to register actual CPU time must be a quirk of the SAS software...

Thanks all.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to report a bug SlipAway172 Mandriva 3 12-01-2004 07:05 PM
Bug report: wrong date/time format in last visited wipe LQ Suggestions & Feedback 0 07-29-2004 07:21 AM
Report Manager nbjayme Fedora 2 01-31-2004 12:03 AM
How can I report the Error Report? domeili Linux - Newbie 1 10-30-2003 06:42 AM
report-in script devhdc Linux - Software 1 09-21-2003 05:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration