开发者

Monitoring context switches in Linux

开发者 https://www.devze.com 2023-02-19 12:41 出处:网络
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

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

精彩评论

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