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
79f3c343
Commit
79f3c343
authored
Feb 12, 2016
by
mcaleavya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed key struct to data as requested
parent
6e789ab1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
tools/biosnoop.py
tools/biosnoop.py
+14
-14
No files found.
tools/biosnoop.py
View file @
79f3c343
...
...
@@ -28,7 +28,7 @@ struct val_t {
char name[TASK_COMM_LEN];
};
struct
key
_t {
struct
data
_t {
u32 pid;
u64 rwflag;
u64 delta;
...
...
@@ -72,7 +72,7 @@ int trace_req_completion(struct pt_regs *ctx, struct request *req)
u64 *tsp, delta;
u32 *pidp = 0;
struct val_t *valp;
struct
key_t key
={};
struct
data_t data
={};
u64 ts;
// fetch timestamp and calculate delta
...
...
@@ -82,28 +82,28 @@ int trace_req_completion(struct pt_regs *ctx, struct request *req)
return 0;
}
ts = bpf_ktime_get_ns();
key
.delta = ts - *tsp;
key
.ts = ts / 1000;
data
.delta = ts - *tsp;
data
.ts = ts / 1000;
valp = infobyreq.lookup(&req);
if (valp == 0) {
key
.len = req->__data_len;
strcpy(
key
.name,"?");
data
.len = req->__data_len;
strcpy(
data
.name,"?");
} else {
key
.pid = valp->pid;
key
.len = req->__data_len;
key
.sector = req->__sector;
bpf_probe_read(&
key.name, sizeof(key
.name), valp->name);
bpf_probe_read(&
key.disk_name, sizeof(key
.disk_name),
data
.pid = valp->pid;
data
.len = req->__data_len;
data
.sector = req->__sector;
bpf_probe_read(&
data.name, sizeof(data
.name), valp->name);
bpf_probe_read(&
data.disk_name, sizeof(data
.disk_name),
req->rq_disk->disk_name);
}
if (req->cmd_flags & REQ_WRITE) {
key
.rwflag=1;
data
.rwflag=1;
} else {
key
.rwflag=0;
data
.rwflag=0;
}
events.perf_submit(ctx,&
key,sizeof(key
));
events.perf_submit(ctx,&
data,sizeof(data
));
start.delete(&req);
infobyreq.delete(&req);
...
...
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