我正在Linux调度程序上做一个项目,试图最小化页面错误的数量 .
我已完成算法实现,我需要测量效果 . 我想知道Linux是否提供了在整个执行过程中发生的记录页数错误的工具?
基本上,我想要类似的东西
$ pfstat ./a.out page faults: 3 Execution Time: 1003 ms
有这样的工具吗?我想在决定自己写一个之前确定一下,这将是很多工作......
在大多数系统上, /usr/bin/time 将报告页面错误,例如:
/usr/bin/time
$ /usr/bin/time /bin/true 0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 1632maxresident)k 40inputs+0outputs (1major+141minor)pagefaults 0swaps
我推荐perf-stat:
$ perf stat make Performance counter stats for 'make': 4.142908 task-clock # 0.781 CPUs utilized 0 context-switches # 0.000 K/sec 0 CPU-migrations # 0.000 K/sec 318 page-faults # 0.077 M/sec 3,111,777 cycles # 0.751 GHz 1,956,914 stalled-cycles-frontend # 62.89% frontend cycles idle 2,275,123 stalled-cycles-backend # 73.11% backend cycles idle 11,244,599 instructions # 3.61 insns per cycle # 0.20 stalled cycles per insn [65.87%] <not counted> branches <not counted> branch-misses 0.005305316 seconds time elapsed
它会计算页面错误以及许多其他性能计数器 .
但它需要您安装包 perf .
perf
2 回答
在大多数系统上,
/usr/bin/time
将报告页面错误,例如:我推荐perf-stat:
它会计算页面错误以及许多其他性能计数器 .
但它需要您安装包
perf
.