forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitehist.c
22 lines (19 loc) · 616 Bytes
/
bitehist.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
* bitehist.c Block I/O size histogram.
* For Linux, uses BCC, eBPF. See .py file.
*
* Copyright (c) 2013-2015 PLUMgrid, https://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;
}