60

If I issue the "top" command and receive results such as:

PID   USER  PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND   
00001 bob   25   0 77380 1212 1200 R 95.8  0.0  89122:13 fee         
00002 bob   25   0 77380 1196 1184 R 95.4  0.0  88954:14 fi         
00003 sam   18   0  427m  16m 6308 R 30.0  0.1  54:46.43 fo         
00004 sam   18   0  427m  16m 6308 R 26.5  0.1  52:55.33 fum         

Question: What are the units in the "TIME+" column?

What I have tried: (please suggest a better strategy for searching documentation ...)

  • man top | grep -C 4 time or
  • man top | grep <X> when I substitute minute, hour, day, or HH for X ...
48

minutes:seconds.hundredths

Searching for “TIME+” or for “seconds” gives the answer, kind of (I wouldn't call the man page clear).

This format is inherited from BSD, you also get it with ps u or ps l under Linux.

  • thanks ... (I found TIME+ from the first search, but was daunted); can I assume that 89122:13 is in units of MM:SS, (89122 minutes and 13 seconds = 60 days)? – Abe Oct 30 '12 at 0:11
  • 1
    @Abe Yes, 89122:13 = 5347333 seconds ≈ 62 days. – Gilles 'SO- stop being evil' Oct 30 '12 at 0:19
  • 1
    @Abe I guess that we can divide that given time for the number of cores and get the clock time since it started... – PJunior Apr 23 '14 at 21:29
  • @Gilles I'm new to Linux. Which time does TIME+ signify? For how much time the job is running? – mithusengupta123 Apr 13 '18 at 12:05
  • @mithusengupta123 That's the amount of CPU time used by the process. It may be a lot less than how long the process has been running if the process isn't CPU-bound, for example a process that spends most of its time idle waiting to serve requests. – Gilles 'SO- stop being evil' Apr 13 '18 at 14:27
59

ps and top display CPU time used, not clock time since the process started. One way to check when the process started is use the following command. The PID file creation date is when the process started:

ls -ld /proc/pid

So for process 2303 it would be:

ls -ld /proc/2303
  • 2
    I don't see anywhere where Gilles said that the values showed clock time... – Chris Down Feb 13 '13 at 11:35
  • Well it leads 'anyone' in mistake, in my opinion. – PJunior Apr 23 '14 at 21:28
  • 16
    Your answer is useful, but stating the 'other answer is totally wrong', is (in my opinion) not accurate. The original question is what units are used. The 'other answer' answers that. It just doesn't specify that this is a measurement of CPU time, not clock time. Your answer clarifies that and so it is useful (but doesn't answer the original question). I will vote your answer up if you remove from your answer that the other answer is 'totally wrong'. – Jason S May 8 '14 at 1:51
  • 2
    This does not seem to work for long running process (may be it does not work for short jobs as well). I see this file gets updated for some other reason as well. There is another way to calculate when the process is created (stackoverflow.com/questions/5731234/…) – Ganesh Dec 8 '16 at 17:48
  • Didn't work for me, after process running for 2 days this file reported a very recent modified time. Also, the OP was "what units", while this is interesting...off topic. – Wilbur Whateley Apr 5 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.