Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
8d70a881
Commit
8d70a881
authored
Sep 25, 2015
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use BPF_HISTOGRAM
parent
6ee90d08
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
14 deletions
+7
-14
README.md
README.md
+1
-1
examples/bitehist.c
examples/bitehist.c
+2
-5
examples/vfsreadlat.c
examples/vfsreadlat.c
+2
-4
tools/funclatency
tools/funclatency
+2
-4
No files found.
README.md
View file @
8d70a881
...
...
@@ -24,7 +24,7 @@ summary is returned to user-level.
# ./bitehist.py
Tracing... Hit Ctrl-C to end.
^C
value
: count distribution
kbytes
: count distribution
0 -> 1 : 3 | |
2 -> 3 : 0 | |
4 -> 7 : 211 |********** |
...
...
examples/bitehist.c
View file @
8d70a881
...
...
@@ -13,13 +13,10 @@
#include <uapi/linux/ptrace.h>
#include <linux/blkdev.h>
BPF_
TABLE
(
"array"
,
int
,
u64
,
dist
,
64
);
BPF_
HISTOGRAM
(
dist
);
int
kprobe__blk_account_io_completion
(
struct
pt_regs
*
ctx
,
struct
request
*
req
)
{
int
index
=
bpf_log2l
(
req
->
__data_len
/
1024
);
u64
*
leaf
=
dist
.
lookup
(
&
index
);
if
(
leaf
)
(
*
leaf
)
++
;
dist
.
increment
(
bpf_log2l
(
req
->
__data_len
/
1024
));
return
0
;
}
examples/vfsreadlat.c
View file @
8d70a881
...
...
@@ -13,7 +13,7 @@
#include <uapi/linux/ptrace.h>
BPF_HASH
(
start
,
u32
);
BPF_
TABLE
(
"array"
,
int
,
u64
,
dist
,
64
);
BPF_
HISTOGRAM
(
dist
);
int
do_entry
(
struct
pt_regs
*
ctx
)
{
...
...
@@ -36,9 +36,7 @@ int do_return(struct pt_regs *ctx)
if
(
tsp
!=
0
)
{
delta
=
bpf_ktime_get_ns
()
-
*
tsp
;
int
index
=
bpf_log2l
(
delta
/
1000
);
u64
*
leaf
=
dist
.
lookup
(
&
index
);
if
(
leaf
)
(
*
leaf
)
++
;
dist
.
increment
(
bpf_log2l
(
delta
/
1000
));
start
.
delete
(
&
pid
);
}
...
...
tools/funclatency
View file @
8d70a881
...
...
@@ -62,8 +62,8 @@ bpf_text = """
#include <uapi/linux/ptrace.h>
#include <linux/blkdev.h>
BPF_TABLE(
\
"
array
\
"
, int, u64, dist, 64);
BPF_HASH(start, u32);
BPF_HISTOGRAM(dist);
int trace_func_entry(struct pt_regs *ctx)
{
...
...
@@ -91,9 +91,7 @@ int trace_func_return(struct pt_regs *ctx)
FACTOR
// store as histogram
int index = bpf_log2l(delta);
u64 *leaf = dist.lookup(&index);
if (leaf) (*leaf)++;
dist.increment(bpf_log2l(delta));
return 0;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment