42 lines
1.0 KiB
Diff
42 lines
1.0 KiB
Diff
From 34c2f6cc1e1059ffe3e5edd7cebeb758e4ba9f36 Mon Sep 17 00:00:00 2001
|
|
From: wuchangye <wuchangye@huawei.com>
|
|
Date: Sun, 24 Mar 2024 00:10:08 +0800
|
|
Subject: [PATCH] perftool: add lhist statstic tool
|
|
|
|
---
|
|
tools/perf/glhist.bt | 21 +++++++++++++++++++++
|
|
1 file changed, 21 insertions(+)
|
|
create mode 100644 tools/perf/glhist.bt
|
|
|
|
diff --git a/tools/perf/glhist.bt b/tools/perf/glhist.bt
|
|
new file mode 100644
|
|
index 0000000..757f6e9
|
|
--- /dev/null
|
|
+++ b/tools/perf/glhist.bt
|
|
@@ -0,0 +1,21 @@
|
|
+#!/usr/bin/env bpftrace
|
|
+/*
|
|
+reference: https://github.com/bpftrace/bpftrace/blob/master/man/adoc/bpftrace.adoc
|
|
+prepare: yum install bpftrace
|
|
+example: ./glhist.bt rpc_poll_msg
|
|
+*/
|
|
+
|
|
+uprobe:/usr/lib64/liblstack.so:$1
|
|
+{
|
|
+ @t_start[tid] = nsecs;
|
|
+}
|
|
+
|
|
+uretprobe:/usr/lib64/liblstack.so:$1
|
|
+{
|
|
+ @t_dur[tid] = nsecs - @t_start[tid];
|
|
+ @t_count[tid] = count();
|
|
+ if (@t_dur[tid] < 1000000000) {
|
|
+ // lhist(int64 n, int64 min, int64 max, int64 step)
|
|
+ @t_hist[tid] = lhist(@t_dur[tid], 0, 4000, 100);
|
|
+ }
|
|
+}
|
|
\ No newline at end of file
|
|
--
|
|
2.33.0
|
|
|