Commit | Line | Data |
---|---|---|
9e066e23 CM |
1 | /* |
2 | * Copyright (C) 2012 Fusion-io | |
3 | * | |
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. | |
7 | * | |
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. | |
12 | * | |
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 | |
16 | * | |
17 | * Parts of this file were imported from Jens Axboe's blktrace sources (also GPL) | |
18 | */ | |
19 | #ifndef __IOWATCH_BLKPARSE__ | |
20 | #define __IOWATCH_BLKPARSE__ | |
21 | #define MINORBITS 20 | |
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) | |
27 | ||
28 | struct trace { | |
29 | int fd; | |
30 | u64 len; | |
31 | char *start; | |
32 | char *cur; | |
33 | struct blk_io_trace *io; | |
34 | u64 start_timestamp; | |
35 | struct timespec abs_start_time; | |
36 | ||
37 | /* | |
38 | * flags for the things we find in the stream | |
39 | * we prefer different events for different things | |
40 | */ | |
41 | int found_issue; | |
42 | int found_completion; | |
43 | int found_queue; | |
e199d546 CM |
44 | |
45 | char *mpstat_start; | |
46 | char *mpstat_cur; | |
47 | u64 mpstat_len; | |
48 | int mpstat_fd; | |
49 | int mpstat_seconds; | |
50 | int mpstat_num_cpus; | |
9e066e23 CM |
51 | }; |
52 | ||
53 | static inline unsigned int MAJOR(unsigned int dev) | |
54 | { | |
55 | return dev >> MINORBITS; | |
56 | } | |
57 | ||
58 | static inline unsigned int MINOR(unsigned int dev) | |
59 | { | |
60 | return dev & MINORMASK; | |
61 | } | |
62 | ||
63 | void init_io_hash_table(void); | |
64 | struct trace *open_trace(char *filename); | |
65 | u64 find_last_time(struct trace *trace); | |
bfb0e441 CM |
66 | void find_highest_offset(struct trace *trace, u64 *max_ret, u64 *max_bank_ret, |
67 | u64 *max_offset_ret); | |
9e066e23 CM |
68 | int filter_outliers(struct trace *trace, u64 max_offset, |
69 | u64 *yzoom_min, u64 *yzoom_max); | |
9e066e23 CM |
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); | |
80 | #endif |