4个版本

0.2.1 2023年11月2日
0.2.0 2023年8月24日
0.1.1 2023年6月12日
0.1.0 2023年5月31日

#197 in 性能分析

Apache-2.0

19KB
211

libtracecmd-rs

A Rust封装库,用于 libtracecmd.

crates.io build status

此库是 libtracecmd 的Rust封装,允许编写程序来分析由 trace-cmd 记录的Linux的 ftrace 数据。

要求

要在程序中使用此crate,您需要在系统上安装libtracecmd库 (>= 1.2.0)。

示例用法

让我们看看它与 examples/top_n_events 的结合使用方式,该示例统计特定时间段内每个事件发生的次数。

首先,通过运行 trace-cmd 创建 trace.dat

trace-cmd record -e syscalls sleep 10

然后,显示trace.dat文件中的前10个系统调用事件。

cargo run --example top_n_events -- --input trace.dat --n 10 --prefix sys_enter_

示例输出

Top 10 events:
#1: ioctl: 62424 times
#2: futex: 59074 times
#3: read: 30144 times
#4: write: 28361 times
#5: newfstatat: 22590 times
#6: close: 15893 times
#7: splice: 14650 times
#8: getuid: 13579 times
#9: epoll_pwait: 12298 times
#10: ppoll: 10523 times

贡献

有关详细信息,请参阅 CONTRIBUTING.md

许可

Apache 2.0;有关详细信息,请参阅 LICENSE

免责声明

此项目不是官方的谷歌项目。它不受谷歌支持,谷歌特别声明对其质量、商业性或特定用途的适用性的任何保证。

依赖项

~0.3–2.6MB
~53K SLoC