注意
本文档适用于 Ceph 的开发版本。
CPU 性能分析
如果您是从源代码构建 Ceph 并为 oprofile 编译了 Ceph,您可以对 Ceph 的 CPU 使用情况进行性能分析。详情请参阅 安装 Oprofile。
初始化 oprofile
首次使用 oprofile 时必须对其进行初始化。找到与您正在运行的内核相对应的 vmlinux 镜像
ls /boot
sudo opcontrol --init
sudo opcontrol --setup --vmlinux={path-to-image} --separate=library --callgraph=6
启动 oprofile
运行以下命令启动 oprofile
opcontrol --start
停止 oprofile
运行以下命令停止 oprofile
opcontrol --stop
获取 oprofile 结果
运行以下命令获取最主要的 cmon 结果
opreport -gal ./cmon | less
运行以下命令获取最主要的 cmon 结果,并附带调用图
opreport -cal ./cmon | less
重要
审查结果后,在再次运行 oprofile 之前对其进行重置。重置 oprofile 的操作会删除会话目录中的数据。
重置 oprofile
运行以下命令重置 oprofile
sudo opcontrol --reset
重要
分析数据后重置 oprofile。这可以确保先前测试的结果不会与当前测试的结果混淆。