有人可以指导我使用 Linux 上的命令或方法来测量线程或进程所经历的迁移次数吗?谢谢你。
最佳答案
我不确定你是否有更好的工具,但你可以使用 perf
工具。
Perf is a profiler tool for Linux 2.6+ based systems that abstracts away CPU hardware differences in Linux performance measurements and presents a simple commandline interface. Perf is based on the perf_events interface exported by recent versions of the Linux kernel.
我从来没有亲自使用过,但是在他们的 website 上你有一个 tutorial和 Counting with perf stat 的输出示例,其中迁移数是输出的一部分。
我希望它有帮助。
关于multithreading - 测量 Linux 上的线程迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8863748/