0

Is it possible to get a count of how many times a process has changed its state? (from running to interruptible sleep for example)

I have a process that calls another process and i would like to track how many calls happened (Neither processes were written by me), the called process is in interruptible sleep until called, then changes to running, then changes back to interruptible sleep until called again.

4
  • The two paragraphs seems to ask two completely separate questions. One is "how to track state changes" and the other is "how many times is one process called from another". Could you please clarify whether you have two or one question?
    – Kusalananda
    Oct 27, 2018 at 9:22
  • Sorry, the second paragraph explains why i would like to get this information, did i clarify?
    – Binyamin
    Oct 27, 2018 at 10:43
  • Interruptible sleep could mean that it's waiting for input. Counting the state changes of the second process may not give you the same answer as counting the number of times that the first process sends data to it. Have you tried running strace on the processes?
    – Kusalananda
    Oct 27, 2018 at 10:46
  • When i run strace i see a lot of read writes to a socket file descriptor, perhaps that is a good enough approximation to what i need
    – Binyamin
    Oct 27, 2018 at 10:53

1 Answer 1

0

If you need to know absolutely every change, you could write a systemtap script to catch every state change. Otherwise, you could write a loop that watches /proc/pid/stat or just use atop.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .