Is there any way to determine whenever a context switch takes place without the use of profilers? I have written a C program to monitor the time taken for different processes in a program to finish execution. I want to show the process/thread context switching as well. The time at which the switch takes place and from prev_id -> curr_id
. These 3 informations would be helpful.
Asked
Active
Viewed 3,189 times
5
1 Answers
3
You can observe voluntary_ctxt_switches and nonvoluntary_ctxt_switches values from the /proc/self/status file.

Michał Šrajer
- 30,364
- 7
- 62
- 85