开发者

Monitoring context switches in Linux

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜