最近在Android上优化swap.目前是前期调研阶段,今天需要追踪到内核的page fault频率,与大家共享。
目前我在fedaro19(64bit)下跑Android模拟器。内核是goldfish,追踪内核page fault用到的工具是perf。
其实只需要一行命令:
perf stat -p 4743
下面是运行的结果:
130|root@generic:/sdcard/lm-kill # perf stat -p 4743 ^C Performance counter stats for process id '4743': 1210.000000 task-clock # 0.008 CPUs utilized 5086 context-switches # 0.004 M/sec 0 CPU-migrations # 0.000 M/sec 10345 page-faults # 0.009 M/sec <not counted> cycles <not counted> stalled-cycles-frontend <not counted> stalled-cycles-backend <not counted> instructions <not counted> branches <not counted> branch-misses 148.527492252 seconds time elapsed
看第7行,我大概运行了148s,期间有10345次page fault.
追踪Android内核运行时page fault
最新推荐文章于 2024-06-20 09:58:14 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)