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
51add789
Commit
51add789
authored
Nov 29, 2016
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
biotop.py: fix compiler error on newer kernels
parent
ae6d979b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
man/man8/biotop.8
man/man8/biotop.8
+1
-1
tools/biotop.py
tools/biotop.py
+15
-3
No files found.
man/man8/biotop.8
View file @
51add789
...
...
@@ -65,7 +65,7 @@ Cached process name, if present. This usually (but isn't guaranteed) to identify
the responsible process for the I/O.
.TP
D
Direction: R == read, W == write.
Direction: R == read, W == write.
This is a simplification.
.TP
MAJ
Major device number.
...
...
tools/biotop.py
View file @
51add789
...
...
@@ -68,7 +68,7 @@ struct who_t {
// the key for the output summary
struct info_t {
u32 pid;
int
type
;
int
rwflag
;
int major;
int minor;
char name[TASK_COMM_LEN];
...
...
@@ -128,7 +128,19 @@ int trace_req_completion(struct pt_regs *ctx, struct request *req)
struct info_t info = {};
info.major = req->rq_disk->major;
info.minor = req->rq_disk->first_minor;
info.type = req->cmd_flags & REQ_WRITE;
/*
* The following deals with a kernel version change (in mainline 4.7, although
* it may be backported to earlier kernels) with how block request write flags
* are tested. We handle both pre- and post-change versions here. Please avoid
* kernel version tests like this as much as possible: they inflate the code,
* test, and maintenance burden.
*/
#ifdef REQ_WRITE
info.rwflag = !!(req->cmd_flags & REQ_WRITE);
#else
info.rwflag = !!((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE);
#endif
whop = whobyreq.lookup(&req);
if (whop == 0) {
// missed pid who, save stats as pid 0
...
...
@@ -199,7 +211,7 @@ while 1:
# print line
avg_ms
=
(
float
(
v
.
us
)
/
1000
)
/
v
.
io
print
(
"%-6d %-16s %1s %-3d %-3d %-8s %5s %7s %6.2f"
%
(
k
.
pid
,
k
.
name
,
"W"
if
k
.
type
else
"R"
,
k
.
major
,
k
.
minor
,
diskname
,
v
.
io
,
"W"
if
k
.
rwflag
else
"R"
,
k
.
major
,
k
.
minor
,
diskname
,
v
.
io
,
v
.
bytes
/
1024
,
avg_ms
))
line
+=
1
...
...
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