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 proces开发者_StackOverflow中文版ses 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.
You can observe voluntary_ctxt_switches and nonvoluntary_ctxt_switches values from the /proc/self/status file.
精彩评论