2 Star 0 Fork 32

我们17走/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0199-perftool-add-latency-tool.patch 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
From a037f2d9d92ea4a5e659297c5c9839557040f1ce Mon Sep 17 00:00:00 2001
From: zhengjiebing <zhengjiebing_yewu@cmss.chinamobile.com>
Date: Fri, 21 Jun 2024 16:48:20 +0800
Subject: [PATCH] perftool: add latency tool
---
tools/perf/latency.bt | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100755 tools/perf/latency.bt
diff --git a/tools/perf/latency.bt b/tools/perf/latency.bt
new file mode 100755
index 0000000..bfe18ae
--- /dev/null
+++ b/tools/perf/latency.bt
@@ -0,0 +1,38 @@
+#!/usr/bin/env bpftrace
+/*
+reference: https://github.com/bpftrace/bpftrace/blob/master/man/adoc/bpftrace.adoc
+prepare: yum install bpftrace
+example: ./latency.bt xxx.so func1 func2
+supported functions: bpftrace -l 'uprobe:xxx.so'
+*/
+
+BEGIN
+{
+}
+
+uprobe:$1:$2
+{
+ @t_start[tid] = nsecs;
+}
+
+uretprobe:$1:$3
+/@t_start[tid]/
+{
+ $t_dur = nsecs - @t_start[tid];
+ @t_avg = avg($t_dur);
+
+ //@t_hist = lhist($t_dur, 0, 4000, 100);
+ @t_hist = hist($t_dur);
+
+ delete(@t_start[tid]);
+}
+
+END
+{
+ printf("\n\n%s -> %s \n", str($2), str($3));
+ printf("average time(nsec):");
+ print(@t_avg);
+
+ clear(@t_avg);
+ clear(@t_start);
+}
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/together17/gazelle.git
git@gitee.com:together17/gazelle.git
together17
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385