0

From here, How to see how many context switches a process makes? I found the method to view the number of context switching of alive process. But I need to view the whole number of context switching from the time when it is created to the time when it is dead. But after it deads, there is no proc filesystem. Is it any method to do it? Thanks for help

5
  • Do you mean context switching for entire OS? Commented Jul 13, 2021 at 14:14
  • No, I mean one process Commented Jul 13, 2021 at 14:16
  • Can you clarify what do you mean by context switching after process dead. AFAIK if the process is dead there is no context switching for it Commented Jul 13, 2021 at 14:17
  • Sorry for poor english. I mean the number of context switch when it was alive. In other words, I need to count the number of it from time when it is created to time when it is dead Commented Jul 13, 2021 at 14:19
  • The other answers to the question you've linked to explain how to start a process in a way that counts the context switches. Is that not what you look for? Commented Dec 3, 2021 at 16:57

1 Answer 1

1

On Linux, when a process dies, the kernel forgets most of the information about it, including context switches, and there’s no way to retrieve this information once it is gone. (Once a process is reaped, everything about it is forgotten.)

You need to instrument the processes you’re interested in ahead of time, using one of the approaches described in the question you linked to.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.