0

As you may know, the /proc/stat file contain the numbers of ticks the different CPU's have spent their time. Same goes to /proc/pid/stat where the tics are measured based on pid (process id)

But when I'm running a process I want to capture the stat file of a given process and see the number of ticks the process used in for example kernel-, user mode etc. For the time the process took to finish.

As of now, the PID file in /stat/ dissapears whenever the process has finished.

  • Are you running the process yourself as a child process, or are you trying to capture the data from the outside, after the process completes? – Andrew Henle Feb 13 at 15:12
  • @AndrewHenle Yes, all of this i'm trying to test out on a linux server, only local data and processes. – emilrn Feb 13 at 15:51
  • 1
    would process accounting do for you? – mosvy Feb 13 at 16:23
  • @mosvy, not really, i'm interessted in the ticks only. – emilrn Feb 13 at 16:41
  • No interface (not even /proc/PID/stat, while the process is still running) will give you the ticks only. Process accounting is the old way to record some process stats after it has died (including the same utime & stime from /proc/PID/stat). There may be better tools now -- but maybe you're just about running your program with time prog args ..., after all. – mosvy Feb 13 at 17:00

Your Answer

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

Browse other questions tagged or ask your own question.