blob: 102ee4db9801ceef16be411c5752c8946c3baab4 [file] [log] [blame]
Brendan Gregg48fbc3e2015-08-18 14:56:14 -07001/*
2 * bitehist.c Block I/O size histogram.
3 * For Linux, uses BCC, eBPF. See .py file.
4 *
Brendan Gregg48fbc3e2015-08-18 14:56:14 -07005 * 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 Gregg68abbec2015-08-18 15:17:29 -070014#include <linux/blkdev.h>
Brendan Gregg48fbc3e2015-08-18 14:56:14 -070015
Brendan Gregg8d70a882015-09-25 11:07:23 -070016BPF_HISTOGRAM(dist);
Brendan Gregg48fbc3e2015-08-18 14:56:14 -070017
Brendan Gregg6ed4a492015-09-16 15:12:55 -070018int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req)
Brendan Gregg48fbc3e2015-08-18 14:56:14 -070019{
Brendan Gregg8d70a882015-09-25 11:07:23 -070020 dist.increment(bpf_log2l(req->__data_len / 1024));
Brendan Gregg48fbc3e2015-08-18 14:56:14 -070021 return 0;
22}