Brendan Gregg | 48fbc3e | 2015-08-18 14:56:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * bitehist.c Block I/O size histogram. |
| 3 | * For Linux, uses BCC, eBPF. See .py file. |
| 4 | * |
Brendan Gregg | 48fbc3e | 2015-08-18 14:56:14 -0700 | [diff] [blame] | 5 | * Copyright (c) 2013-2015 PLUMgrid, http://plumgrid.com |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of version 2 of the GNU General Public |
| 8 | * License as published by the Free Software Foundation. |
| 9 | * |
| 10 | * 15-Aug-2015 Brendan Gregg Created this. |
| 11 | */ |
| 12 | |
| 13 | #include <uapi/linux/ptrace.h> |
Brendan Gregg | 68abbec | 2015-08-18 15:17:29 -0700 | [diff] [blame] | 14 | #include <linux/blkdev.h> |
Brendan Gregg | 48fbc3e | 2015-08-18 14:56:14 -0700 | [diff] [blame] | 15 | |
Brendan Gregg | 8d70a88 | 2015-09-25 11:07:23 -0700 | [diff] [blame] | 16 | BPF_HISTOGRAM(dist); |
Brendan Gregg | 48fbc3e | 2015-08-18 14:56:14 -0700 | [diff] [blame] | 17 | |
Brendan Gregg | 6ed4a49 | 2015-09-16 15:12:55 -0700 | [diff] [blame] | 18 | int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req) |
Brendan Gregg | 48fbc3e | 2015-08-18 14:56:14 -0700 | [diff] [blame] | 19 | { |
Brendan Gregg | 8d70a88 | 2015-09-25 11:07:23 -0700 | [diff] [blame] | 20 | dist.increment(bpf_log2l(req->__data_len / 1024)); |
Brendan Gregg | 48fbc3e | 2015-08-18 14:56:14 -0700 | [diff] [blame] | 21 | return 0; |
| 22 | } |