2 * Copyright (C) 2012 Fusion-io
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * Parts of this file were imported from Jens Axboe's blktrace sources (also GPL)
19 #ifndef __IOWATCH_BLKPARSE__
20 #define __IOWATCH_BLKPARSE__
22 #define MINORMASK ((1 << MINORBITS) - 1)
23 #define SECONDS(x) ((unsigned long long)(x) / 1000000000)
24 #define NANO_SECONDS(x) ((unsigned long long)(x) % 1000000000)
25 #define DOUBLE_TO_NANO_ULL(d) ((unsigned long long)((d) * 1000000000))
26 #define CHECK_MAGIC(t) (((t)->magic & 0xffffff00) == BLK_IO_TRACE_MAGIC)
33 struct blk_io_trace *io;
35 struct timespec abs_start_time;
38 * flags for the things we find in the stream
39 * we prefer different events for different things
53 static inline unsigned int MAJOR(unsigned int dev)
55 return dev >> MINORBITS;
58 static inline unsigned int MINOR(unsigned int dev)
60 return dev & MINORMASK;
63 void init_io_hash_table(void);
64 struct trace *open_trace(char *filename);
65 u64 find_last_time(struct trace *trace);
66 void find_highest_offset(struct trace *trace, u64 *max_ret, u64 *max_bank_ret,
68 int filter_outliers(struct trace *trace, u64 max_offset,
69 u64 *yzoom_min, u64 *yzoom_max);
70 void add_iop(struct trace *trace, struct graph_line_data *gld);
71 void check_record(struct trace *trace);
72 void add_completed_io(struct trace *trace,
73 struct graph_line_data *latency_gld);
74 void add_io(struct trace *trace, struct graph_dot_data *gdd_writes,
75 struct graph_dot_data *gdd_reads);
76 void add_tput(struct trace *trace, struct graph_line_data *gld);
77 void add_pending_io(struct trace *trace, struct graph_line_data *gld);
78 int next_record(struct trace *trace);
79 void first_record(struct trace *trace);