Files
ldb/ebpf/leak_detect/complete.bpf

39 lines
719 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bpftrace
BEGIN
{
printf("开始统计 kvstore 进程的 __completed_cmd 调用次数...\n");
printf("每 5 秒打印一次统计Ctrl-C 退出\n\n");
// 统计变量
@enter = 0;
@exit = 0;
}
interval:s:5
{
time("%H:%M:%S");
printf(" __completed_enter_cmd 调用次数: %10d\n", @enter);
printf(" __completed_exit_cmd 调用次数: %10d\n", @exit);
// 可选:如果想每轮清零统计,取消下面注释
// clear(@enter);
// clear(@exit);
}
uprobe:/home/lian/share/9.1-kvstore/kvstore:__completed_cmd
{
@exit++;
}
uretprobe:/home/lian/share/9.1-kvstore/kvstore:__completed_cmd
{
@enter++;
}
END
{
printf("\n最终统计\n");
}