【问题标题】:Monitoring context switches in Linux在 Linux 中监视上下文切换
【发布时间】:2011-07-22 20:32:46
【问题描述】:

有没有办法在不使用分析器的情况下确定何时发生上下文切换?我编写了一个 C 程序来监视程序中不同进程完成执行所花费的时间。我也想展示进程/线程上下文切换。切换发生的时间和来自prev_id -> curr_id。这 3 个信息会有所帮助。

【问题讨论】:

    标签: c linux profiler context-switch oprofile


    【解决方案1】:

    您可以从 /proc/self/status 文件中观察 volunitarian_ctxt_switches 和 nonvolunitarian_ctxt_switches 值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-18
      • 2013-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-17
      • 1970-01-01
      相关资源
      最近更新 更多