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
310ab537
Commit
310ab537
authored
Jul 24, 2016
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge bitehist example
parent
fa5f2f9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
29 deletions
+17
-29
README.md
README.md
+4
-5
examples/tracing/bitehist.c
examples/tracing/bitehist.c
+0
-22
examples/tracing/bitehist.py
examples/tracing/bitehist.py
+13
-2
No files found.
README.md
View file @
310ab537
...
@@ -38,10 +38,9 @@ Tracing... Hit Ctrl-C to end.
...
@@ -38,10 +38,9 @@ Tracing... Hit Ctrl-C to end.
The above output shows a bimodal distribution, where the largest mode of
The above output shows a bimodal distribution, where the largest mode of
800 I/O was between 128 and 255 Kbytes in size.
800 I/O was between 128 and 255 Kbytes in size.
See the source:
[
bitehist.c
](
examples/tracing/bitehist.c
)
and
See the source:
[
bitehist.py
](
examples/tracing/bitehist.py
)
. What this traces,
[
bitehist.py
](
examples/tracing/bitehist.py
)
. What this traces, what this stores, and how
what this stores, and how the data is presented, can be entirely customized.
the data is presented, can be entirely customized. This shows only some of
This shows only some of many possible capabilities.
many possible capabilities.
## Installing
## Installing
...
@@ -60,7 +59,7 @@ pair of .c and .py files, and some are directories of files.
...
@@ -60,7 +59,7 @@ pair of .c and .py files, and some are directories of files.
Examples:
Examples:
-
examples/tracing/
[
bitehist.py
](
examples/tracing/bitehist.py
)
examples/tracing/
[
bitehist.c
](
examples/tracing/bitehist.c
)
: Block I/O size histogram.
[
Examples
](
examples/tracing/bitehist_example.txt
)
.
-
examples/tracing/
[
bitehist.py
](
examples/tracing/bitehist.py
)
: Block I/O size histogram.
[
Examples
](
examples/tracing/bitehist_example.txt
)
.
-
examples/tracing/
[
disksnoop.py
](
examples/tracing/disksnoop.py
)
examples/tracing/
[
disksnoop.c
](
examples/tracing/disksnoop.c
)
: Trace block device I/O latency.
[
Examples
](
examples/tracing/disksnoop_example.txt
)
.
-
examples/tracing/
[
disksnoop.py
](
examples/tracing/disksnoop.py
)
examples/tracing/
[
disksnoop.c
](
examples/tracing/disksnoop.c
)
: Trace block device I/O latency.
[
Examples
](
examples/tracing/disksnoop_example.txt
)
.
-
examples/
[
hello_world.py
](
examples/hello_world.py
)
: Prints "Hello, World!" for new processes.
-
examples/
[
hello_world.py
](
examples/hello_world.py
)
: Prints "Hello, World!" for new processes.
-
examples/tracing/
[
tcpv4connect.py
](
examples/tracing/tcpv4connect.py
)
: Trace TCP IPv4 active connections.
[
Examples
](
examples/tracing/tcpv4connect_example.txt
)
.
-
examples/tracing/
[
tcpv4connect.py
](
examples/tracing/tcpv4connect.py
)
: Trace TCP IPv4 active connections.
[
Examples
](
examples/tracing/tcpv4connect_example.txt
)
.
...
...
examples/tracing/bitehist.c
deleted
100644 → 0
View file @
fa5f2f9e
/*
* bitehist.c Block I/O size histogram.
* For Linux, uses BCC, eBPF. See .py file.
*
* Copyright (c) 2013-2015 PLUMgrid, http://plumgrid.com
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 15-Aug-2015 Brendan Gregg Created this.
*/
#include <uapi/linux/ptrace.h>
#include <linux/blkdev.h>
BPF_HISTOGRAM
(
dist
);
int
kprobe__blk_account_io_completion
(
struct
pt_regs
*
ctx
,
struct
request
*
req
)
{
dist
.
increment
(
bpf_log2l
(
req
->
__data_len
/
1024
));
return
0
;
}
examples/tracing/bitehist.py
View file @
310ab537
#!/usr/bin/python
#!/usr/bin/python
#
#
# bitehist.py Block I/O size histogram.
# bitehist.py Block I/O size histogram.
# For Linux, uses BCC, eBPF.
See .c file
.
# For Linux, uses BCC, eBPF.
Embedded C
.
#
#
# Written as a basic example of using a histogram to show a distribution.
# Written as a basic example of using a histogram to show a distribution.
#
#
...
@@ -17,7 +17,18 @@ from bcc import BPF
...
@@ -17,7 +17,18 @@ from bcc import BPF
from
time
import
sleep
from
time
import
sleep
# load BPF program
# load BPF program
b
=
BPF
(
src_file
=
"bitehist.c"
)
b
=
BPF
(
text
=
"""
#include <uapi/linux/ptrace.h>
#include <linux/blkdev.h>
BPF_HISTOGRAM(dist);
int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req)
{
dist.increment(bpf_log2l(req->__data_len / 1024));
return 0;
}
"""
)
# header
# header
print
(
"Tracing... Hit Ctrl-C to end."
)
print
(
"Tracing... Hit Ctrl-C to end."
)
...
...
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