1*1a3d31e3SAndroid Build Coastguard Worker /* 2*1a3d31e3SAndroid Build Coastguard Worker * blktrace output analysis: generate a timeline & gather statistics 3*1a3d31e3SAndroid Build Coastguard Worker * 4*1a3d31e3SAndroid Build Coastguard Worker * Copyright (C) 2006 Alan D. Brunelle <[email protected]> 5*1a3d31e3SAndroid Build Coastguard Worker * 6*1a3d31e3SAndroid Build Coastguard Worker * This program is free software; you can redistribute it and/or modify 7*1a3d31e3SAndroid Build Coastguard Worker * it under the terms of the GNU General Public License as published by 8*1a3d31e3SAndroid Build Coastguard Worker * the Free Software Foundation; either version 2 of the License, or 9*1a3d31e3SAndroid Build Coastguard Worker * (at your option) any later version. 10*1a3d31e3SAndroid Build Coastguard Worker * 11*1a3d31e3SAndroid Build Coastguard Worker * This program is distributed in the hope that it will be useful, 12*1a3d31e3SAndroid Build Coastguard Worker * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*1a3d31e3SAndroid Build Coastguard Worker * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*1a3d31e3SAndroid Build Coastguard Worker * GNU General Public License for more details. 15*1a3d31e3SAndroid Build Coastguard Worker * 16*1a3d31e3SAndroid Build Coastguard Worker * You should have received a copy of the GNU General Public License 17*1a3d31e3SAndroid Build Coastguard Worker * along with this program; if not, write to the Free Software 18*1a3d31e3SAndroid Build Coastguard Worker * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19*1a3d31e3SAndroid Build Coastguard Worker * 20*1a3d31e3SAndroid Build Coastguard Worker */ 21*1a3d31e3SAndroid Build Coastguard Worker #include <stdio.h> 22*1a3d31e3SAndroid Build Coastguard Worker #include <string.h> 23*1a3d31e3SAndroid Build Coastguard Worker #include <time.h> 24*1a3d31e3SAndroid Build Coastguard Worker 25*1a3d31e3SAndroid Build Coastguard Worker #include "blktrace.h" 26*1a3d31e3SAndroid Build Coastguard Worker #include "rbtree.h" 27*1a3d31e3SAndroid Build Coastguard Worker #include "list.h" 28*1a3d31e3SAndroid Build Coastguard Worker 29*1a3d31e3SAndroid Build Coastguard Worker /* 30*1a3d31e3SAndroid Build Coastguard Worker * 0 == 1 blk 31*1a3d31e3SAndroid Build Coastguard Worker * 1 == 2 blks 32*1a3d31e3SAndroid Build Coastguard Worker * ... 33*1a3d31e3SAndroid Build Coastguard Worker * 1022 == 1023 blks 34*1a3d31e3SAndroid Build Coastguard Worker * 1023 == 1024 blks 35*1a3d31e3SAndroid Build Coastguard Worker * 1024 == > 1024 blks 36*1a3d31e3SAndroid Build Coastguard Worker */ 37*1a3d31e3SAndroid Build Coastguard Worker #define N_HIST_BKTS 1025 38*1a3d31e3SAndroid Build Coastguard Worker 39*1a3d31e3SAndroid Build Coastguard Worker #define BIT_TIME(t) ((double)SECONDS(t) + ((double)NANO_SECONDS(t) / 1.0e9)) 40*1a3d31e3SAndroid Build Coastguard Worker 41*1a3d31e3SAndroid Build Coastguard Worker #define BIT_START(iop) ((iop)->t.sector) 42*1a3d31e3SAndroid Build Coastguard Worker #define BIT_END(iop) ((iop)->t.sector + ((iop)->t.bytes >> 9)) 43*1a3d31e3SAndroid Build Coastguard Worker #define IOP_READ(iop) ((iop)->t.action & BLK_TC_ACT(BLK_TC_READ)) 44*1a3d31e3SAndroid Build Coastguard Worker #define IOP_RW(iop) (IOP_READ(iop) ? 1 : 0) 45*1a3d31e3SAndroid Build Coastguard Worker 46*1a3d31e3SAndroid Build Coastguard Worker #define TO_SEC(nanosec) ((double)(nanosec) / 1.0e9) 47*1a3d31e3SAndroid Build Coastguard Worker #define TO_MSEC(nanosec) (1000.0 * TO_SEC(nanosec)) 48*1a3d31e3SAndroid Build Coastguard Worker 49*1a3d31e3SAndroid Build Coastguard Worker enum iop_type { 50*1a3d31e3SAndroid Build Coastguard Worker IOP_Q = 0, 51*1a3d31e3SAndroid Build Coastguard Worker IOP_X = 1, 52*1a3d31e3SAndroid Build Coastguard Worker IOP_A = 2, 53*1a3d31e3SAndroid Build Coastguard Worker IOP_G = 3, 54*1a3d31e3SAndroid Build Coastguard Worker IOP_M = 4, 55*1a3d31e3SAndroid Build Coastguard Worker IOP_D = 5, 56*1a3d31e3SAndroid Build Coastguard Worker IOP_C = 6, 57*1a3d31e3SAndroid Build Coastguard Worker IOP_R = 7, 58*1a3d31e3SAndroid Build Coastguard Worker IOP_I = 8, 59*1a3d31e3SAndroid Build Coastguard Worker IOP_S = 9 60*1a3d31e3SAndroid Build Coastguard Worker }; 61*1a3d31e3SAndroid Build Coastguard Worker #define N_IOP_TYPES (IOP_S + 1) 62*1a3d31e3SAndroid Build Coastguard Worker 63*1a3d31e3SAndroid Build Coastguard Worker struct mode { 64*1a3d31e3SAndroid Build Coastguard Worker int most_seeks, nmds; 65*1a3d31e3SAndroid Build Coastguard Worker long long *modes; 66*1a3d31e3SAndroid Build Coastguard Worker }; 67*1a3d31e3SAndroid Build Coastguard Worker 68*1a3d31e3SAndroid Build Coastguard Worker struct io; 69*1a3d31e3SAndroid Build Coastguard Worker struct io_list { 70*1a3d31e3SAndroid Build Coastguard Worker struct list_head head; 71*1a3d31e3SAndroid Build Coastguard Worker struct io *iop; 72*1a3d31e3SAndroid Build Coastguard Worker int cy_users; 73*1a3d31e3SAndroid Build Coastguard Worker }; 74*1a3d31e3SAndroid Build Coastguard Worker 75*1a3d31e3SAndroid Build Coastguard Worker struct avg_info { 76*1a3d31e3SAndroid Build Coastguard Worker __u64 min, max, total; 77*1a3d31e3SAndroid Build Coastguard Worker double avg; 78*1a3d31e3SAndroid Build Coastguard Worker int n; 79*1a3d31e3SAndroid Build Coastguard Worker }; 80*1a3d31e3SAndroid Build Coastguard Worker 81*1a3d31e3SAndroid Build Coastguard Worker struct avgs_info { 82*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2q_dm; 83*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2a_dm; 84*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2c_dm; 85*1a3d31e3SAndroid Build Coastguard Worker 86*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2q; 87*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2a; 88*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2g; 89*1a3d31e3SAndroid Build Coastguard Worker struct avg_info s2g; 90*1a3d31e3SAndroid Build Coastguard Worker struct avg_info g2i; 91*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2m; 92*1a3d31e3SAndroid Build Coastguard Worker struct avg_info i2d; 93*1a3d31e3SAndroid Build Coastguard Worker struct avg_info m2d; 94*1a3d31e3SAndroid Build Coastguard Worker struct avg_info d2c; 95*1a3d31e3SAndroid Build Coastguard Worker struct avg_info q2c; 96*1a3d31e3SAndroid Build Coastguard Worker 97*1a3d31e3SAndroid Build Coastguard Worker struct avg_info blks; /* Blocks transferred */ 98*1a3d31e3SAndroid Build Coastguard Worker }; 99*1a3d31e3SAndroid Build Coastguard Worker 100*1a3d31e3SAndroid Build Coastguard Worker struct range_info { 101*1a3d31e3SAndroid Build Coastguard Worker struct list_head head; /* on: qranges OR cranges */ 102*1a3d31e3SAndroid Build Coastguard Worker __u64 start, end; 103*1a3d31e3SAndroid Build Coastguard Worker }; 104*1a3d31e3SAndroid Build Coastguard Worker 105*1a3d31e3SAndroid Build Coastguard Worker struct region_info { 106*1a3d31e3SAndroid Build Coastguard Worker struct list_head qranges; 107*1a3d31e3SAndroid Build Coastguard Worker struct list_head cranges; 108*1a3d31e3SAndroid Build Coastguard Worker }; 109*1a3d31e3SAndroid Build Coastguard Worker 110*1a3d31e3SAndroid Build Coastguard Worker struct p_info { 111*1a3d31e3SAndroid Build Coastguard Worker struct region_info regions; 112*1a3d31e3SAndroid Build Coastguard Worker struct avgs_info avgs; 113*1a3d31e3SAndroid Build Coastguard Worker __u64 last_q; 114*1a3d31e3SAndroid Build Coastguard Worker __u32 pid; 115*1a3d31e3SAndroid Build Coastguard Worker char *name; 116*1a3d31e3SAndroid Build Coastguard Worker }; 117*1a3d31e3SAndroid Build Coastguard Worker 118*1a3d31e3SAndroid Build Coastguard Worker struct stats { 119*1a3d31e3SAndroid Build Coastguard Worker __u64 rqm[2], ios[2], sec[2], wait, svctm; 120*1a3d31e3SAndroid Build Coastguard Worker double last_qu_change, last_dev_change, tot_qusz, idle_time; 121*1a3d31e3SAndroid Build Coastguard Worker int cur_qusz, cur_dev; 122*1a3d31e3SAndroid Build Coastguard Worker }; 123*1a3d31e3SAndroid Build Coastguard Worker 124*1a3d31e3SAndroid Build Coastguard Worker struct stats_t { 125*1a3d31e3SAndroid Build Coastguard Worker double n; 126*1a3d31e3SAndroid Build Coastguard Worker double rqm_s[2], ios_s[2], sec_s[2]; 127*1a3d31e3SAndroid Build Coastguard Worker double avgrq_sz, avgqu_sz, await, svctm, p_util; 128*1a3d31e3SAndroid Build Coastguard Worker }; 129*1a3d31e3SAndroid Build Coastguard Worker 130*1a3d31e3SAndroid Build Coastguard Worker struct d_info { 131*1a3d31e3SAndroid Build Coastguard Worker struct list_head all_head, hash_head; 132*1a3d31e3SAndroid Build Coastguard Worker void *heads; 133*1a3d31e3SAndroid Build Coastguard Worker struct region_info regions; 134*1a3d31e3SAndroid Build Coastguard Worker char *devmap, dip_name[256]; 135*1a3d31e3SAndroid Build Coastguard Worker void *q2q_handle, *seek_handle, *bno_dump_handle, *up_hist_handle; 136*1a3d31e3SAndroid Build Coastguard Worker void *q2d_priv, *aqd_handle, *rstat_handle, *p_live_handle; 137*1a3d31e3SAndroid Build Coastguard Worker void *q2d_plat_handle, *q2c_plat_handle, *d2c_plat_handle; 138*1a3d31e3SAndroid Build Coastguard Worker FILE *q2d_ofp, *d2c_ofp, *q2c_ofp, *pit_fp; 139*1a3d31e3SAndroid Build Coastguard Worker struct avgs_info avgs; 140*1a3d31e3SAndroid Build Coastguard Worker struct stats stats, all_stats; 141*1a3d31e3SAndroid Build Coastguard Worker __u64 last_q, n_qs, n_ds; 142*1a3d31e3SAndroid Build Coastguard Worker __u64 n_act_q, t_act_q; /* # currently active when Q comes in */ 143*1a3d31e3SAndroid Build Coastguard Worker __u32 device; 144*1a3d31e3SAndroid Build Coastguard Worker 145*1a3d31e3SAndroid Build Coastguard Worker int pre_culling; 146*1a3d31e3SAndroid Build Coastguard Worker int is_plugged, nplugs, nplugs_t; 147*1a3d31e3SAndroid Build Coastguard Worker __u64 nios_up, nios_upt; 148*1a3d31e3SAndroid Build Coastguard Worker double start_time, last_plug, plugged_time, end_time; 149*1a3d31e3SAndroid Build Coastguard Worker }; 150*1a3d31e3SAndroid Build Coastguard Worker 151*1a3d31e3SAndroid Build Coastguard Worker struct io { 152*1a3d31e3SAndroid Build Coastguard Worker struct rb_node rb_node; 153*1a3d31e3SAndroid Build Coastguard Worker struct list_head f_head, a_head; 154*1a3d31e3SAndroid Build Coastguard Worker struct d_info *dip; 155*1a3d31e3SAndroid Build Coastguard Worker struct p_info *pip; 156*1a3d31e3SAndroid Build Coastguard Worker void *pdu; 157*1a3d31e3SAndroid Build Coastguard Worker __u64 bytes_left, g_time, i_time, m_time, d_time, c_time, d_sec, c_sec; 158*1a3d31e3SAndroid Build Coastguard Worker __u64 s_time; 159*1a3d31e3SAndroid Build Coastguard Worker __u32 d_nsec, c_nsec; 160*1a3d31e3SAndroid Build Coastguard Worker 161*1a3d31e3SAndroid Build Coastguard Worker struct blk_io_trace t; 162*1a3d31e3SAndroid Build Coastguard Worker 163*1a3d31e3SAndroid Build Coastguard Worker int linked; 164*1a3d31e3SAndroid Build Coastguard Worker enum iop_type type; 165*1a3d31e3SAndroid Build Coastguard Worker }; 166*1a3d31e3SAndroid Build Coastguard Worker 167*1a3d31e3SAndroid Build Coastguard Worker struct p_live_info { 168*1a3d31e3SAndroid Build Coastguard Worker unsigned long nlives; 169*1a3d31e3SAndroid Build Coastguard Worker double avg_live, avg_lull, p_live; 170*1a3d31e3SAndroid Build Coastguard Worker }; 171*1a3d31e3SAndroid Build Coastguard Worker 172*1a3d31e3SAndroid Build Coastguard Worker /* bt_timeline.c */ 173*1a3d31e3SAndroid Build Coastguard Worker 174*1a3d31e3SAndroid Build Coastguard Worker extern char bt_timeline_version[], *devices, *exes, *input_name, *output_name; 175*1a3d31e3SAndroid Build Coastguard Worker extern char *seek_name, *iostat_name, *d2c_name, *q2c_name, *per_io_name; 176*1a3d31e3SAndroid Build Coastguard Worker extern char *bno_dump_name, *unplug_hist_name, *sps_name, *aqd_name, *q2d_name; 177*1a3d31e3SAndroid Build Coastguard Worker extern char *per_io_trees; 178*1a3d31e3SAndroid Build Coastguard Worker extern double range_delta, plat_freq, last_t_seen; 179*1a3d31e3SAndroid Build Coastguard Worker extern FILE *rngs_ofp, *avgs_ofp, *xavgs_ofp, *iostat_ofp, *per_io_ofp; 180*1a3d31e3SAndroid Build Coastguard Worker extern FILE *msgs_ofp; 181*1a3d31e3SAndroid Build Coastguard Worker extern int verbose, done, time_bounded, output_all_data, seek_absolute; 182*1a3d31e3SAndroid Build Coastguard Worker extern int easy_parse_avgs, ignore_remaps, do_p_live; 183*1a3d31e3SAndroid Build Coastguard Worker extern unsigned int n_devs; 184*1a3d31e3SAndroid Build Coastguard Worker extern unsigned long n_traces; 185*1a3d31e3SAndroid Build Coastguard Worker extern struct list_head all_devs, all_procs; 186*1a3d31e3SAndroid Build Coastguard Worker extern struct avgs_info all_avgs; 187*1a3d31e3SAndroid Build Coastguard Worker extern __u64 last_q; 188*1a3d31e3SAndroid Build Coastguard Worker extern struct region_info all_regions; 189*1a3d31e3SAndroid Build Coastguard Worker extern struct list_head all_ios, free_ios; 190*1a3d31e3SAndroid Build Coastguard Worker extern __u64 iostat_interval, iostat_last_stamp; 191*1a3d31e3SAndroid Build Coastguard Worker extern time_t genesis, last_vtrace; 192*1a3d31e3SAndroid Build Coastguard Worker extern double t_astart, t_aend; 193*1a3d31e3SAndroid Build Coastguard Worker extern __u64 q_histo[N_HIST_BKTS], d_histo[N_HIST_BKTS]; 194*1a3d31e3SAndroid Build Coastguard Worker 195*1a3d31e3SAndroid Build Coastguard Worker /* args.c */ 196*1a3d31e3SAndroid Build Coastguard Worker void handle_args(int argc, char *argv[]); 197*1a3d31e3SAndroid Build Coastguard Worker void clean_args(); 198*1a3d31e3SAndroid Build Coastguard Worker 199*1a3d31e3SAndroid Build Coastguard Worker /* aqd.c */ 200*1a3d31e3SAndroid Build Coastguard Worker void *aqd_alloc(struct d_info *dip); 201*1a3d31e3SAndroid Build Coastguard Worker void aqd_free(void *info); 202*1a3d31e3SAndroid Build Coastguard Worker void aqd_clean(void); 203*1a3d31e3SAndroid Build Coastguard Worker void aqd_issue(void *info, double ts); 204*1a3d31e3SAndroid Build Coastguard Worker void aqd_complete(void *info, double ts); 205*1a3d31e3SAndroid Build Coastguard Worker 206*1a3d31e3SAndroid Build Coastguard Worker /* devmap.c */ 207*1a3d31e3SAndroid Build Coastguard Worker int dev_map_read(char *fname); 208*1a3d31e3SAndroid Build Coastguard Worker char *dev_map_find(__u32 device); 209*1a3d31e3SAndroid Build Coastguard Worker void dev_map_exit(void); 210*1a3d31e3SAndroid Build Coastguard Worker 211*1a3d31e3SAndroid Build Coastguard Worker /* devs.c */ 212*1a3d31e3SAndroid Build Coastguard Worker void init_dev_heads(void); 213*1a3d31e3SAndroid Build Coastguard Worker struct d_info *dip_alloc(__u32 device, struct io *iop); 214*1a3d31e3SAndroid Build Coastguard Worker void iop_rem_dip(struct io *iop); 215*1a3d31e3SAndroid Build Coastguard Worker struct d_info *__dip_find(__u32 device); 216*1a3d31e3SAndroid Build Coastguard Worker void dip_foreach_list(struct io *iop, enum iop_type type, struct list_head *hd); 217*1a3d31e3SAndroid Build Coastguard Worker void dip_foreach(struct io *iop, enum iop_type type, 218*1a3d31e3SAndroid Build Coastguard Worker void (*fnc)(struct io *iop, struct io *this), int rm_after); 219*1a3d31e3SAndroid Build Coastguard Worker struct io *dip_find_sec(struct d_info *dip, enum iop_type type, __u64 sec); 220*1a3d31e3SAndroid Build Coastguard Worker void dip_foreach_out(void (*func)(struct d_info *, void *), void *arg); 221*1a3d31e3SAndroid Build Coastguard Worker void dip_plug(__u32 dev, double cur_time); 222*1a3d31e3SAndroid Build Coastguard Worker void dip_unplug(__u32 dev, double cur_time, __u64 nio_ups); 223*1a3d31e3SAndroid Build Coastguard Worker void dip_unplug_tm(__u32 dev, double cur_time, __u64 nio_ups); 224*1a3d31e3SAndroid Build Coastguard Worker void dip_exit(void); 225*1a3d31e3SAndroid Build Coastguard Worker void dip_cleanup(void); 226*1a3d31e3SAndroid Build Coastguard Worker 227*1a3d31e3SAndroid Build Coastguard Worker /* dip_rb.c */ 228*1a3d31e3SAndroid Build Coastguard Worker int rb_insert(struct rb_root *root, struct io *iop); 229*1a3d31e3SAndroid Build Coastguard Worker struct io *rb_find_sec(struct rb_root *root, __u64 sec); 230*1a3d31e3SAndroid Build Coastguard Worker void rb_foreach(struct rb_node *n, struct io *iop, 231*1a3d31e3SAndroid Build Coastguard Worker void (*fnc)(struct io *iop, struct io *this), 232*1a3d31e3SAndroid Build Coastguard Worker struct list_head *head); 233*1a3d31e3SAndroid Build Coastguard Worker 234*1a3d31e3SAndroid Build Coastguard Worker /* iostat.c */ 235*1a3d31e3SAndroid Build Coastguard Worker void iostat_init(void); 236*1a3d31e3SAndroid Build Coastguard Worker void iostat_getrq(struct io *iop); 237*1a3d31e3SAndroid Build Coastguard Worker void iostat_merge(struct io *iop); 238*1a3d31e3SAndroid Build Coastguard Worker void iostat_issue(struct io *iop); 239*1a3d31e3SAndroid Build Coastguard Worker void iostat_complete(struct io *d_iop, struct io *c_iop); 240*1a3d31e3SAndroid Build Coastguard Worker void iostat_check_time(__u64 stamp); 241*1a3d31e3SAndroid Build Coastguard Worker void iostat_dump_stats(__u64 stamp, int all); 242*1a3d31e3SAndroid Build Coastguard Worker 243*1a3d31e3SAndroid Build Coastguard Worker /* latency.c */ 244*1a3d31e3SAndroid Build Coastguard Worker void latency_alloc(struct d_info *dip); 245*1a3d31e3SAndroid Build Coastguard Worker void latency_clean(void); 246*1a3d31e3SAndroid Build Coastguard Worker void latency_q2d(struct d_info *dip, __u64 tstamp, __u64 latency); 247*1a3d31e3SAndroid Build Coastguard Worker void latency_d2c(struct d_info *dip, __u64 tstamp, __u64 latency); 248*1a3d31e3SAndroid Build Coastguard Worker void latency_q2c(struct d_info *dip, __u64 tstamp, __u64 latency); 249*1a3d31e3SAndroid Build Coastguard Worker 250*1a3d31e3SAndroid Build Coastguard Worker /* misc.c */ 251*1a3d31e3SAndroid Build Coastguard Worker void add_file(FILE *fp, char *oname); 252*1a3d31e3SAndroid Build Coastguard Worker void add_buf(void *buf); 253*1a3d31e3SAndroid Build Coastguard Worker char *make_dev_hdr(char *pad, size_t len, struct d_info *dip, int add_parens); 254*1a3d31e3SAndroid Build Coastguard Worker char *mkhandle(struct d_info *dip, char *str, size_t len); 255*1a3d31e3SAndroid Build Coastguard Worker FILE *my_fopen(const char *path, const char *mode); 256*1a3d31e3SAndroid Build Coastguard Worker int my_open(const char *path, int flags); 257*1a3d31e3SAndroid Build Coastguard Worker void dbg_ping(void); 258*1a3d31e3SAndroid Build Coastguard Worker void clean_allocs(void); 259*1a3d31e3SAndroid Build Coastguard Worker 260*1a3d31e3SAndroid Build Coastguard Worker /* mmap.c */ 261*1a3d31e3SAndroid Build Coastguard Worker void setup_ifile(char *fname); 262*1a3d31e3SAndroid Build Coastguard Worker void cleanup_ifile(void); 263*1a3d31e3SAndroid Build Coastguard Worker int next_trace(struct blk_io_trace *t, void **pdu); 264*1a3d31e3SAndroid Build Coastguard Worker double pct_done(void); 265*1a3d31e3SAndroid Build Coastguard Worker 266*1a3d31e3SAndroid Build Coastguard Worker /* output.c */ 267*1a3d31e3SAndroid Build Coastguard Worker int output_avgs(FILE *ofp); 268*1a3d31e3SAndroid Build Coastguard Worker int output_ranges(FILE *ofp); 269*1a3d31e3SAndroid Build Coastguard Worker 270*1a3d31e3SAndroid Build Coastguard Worker /* proc.c */ 271*1a3d31e3SAndroid Build Coastguard Worker void process_alloc(__u32 pid, char *name); 272*1a3d31e3SAndroid Build Coastguard Worker struct p_info *find_process(__u32 pid, char *name); 273*1a3d31e3SAndroid Build Coastguard Worker void pip_update_q(struct io *iop); 274*1a3d31e3SAndroid Build Coastguard Worker void pip_foreach_out(void (*f)(struct p_info *, void *), void *arg); 275*1a3d31e3SAndroid Build Coastguard Worker void pip_exit(void); 276*1a3d31e3SAndroid Build Coastguard Worker 277*1a3d31e3SAndroid Build Coastguard Worker /* bno_dump.c */ 278*1a3d31e3SAndroid Build Coastguard Worker void *bno_dump_alloc(struct d_info *dip); 279*1a3d31e3SAndroid Build Coastguard Worker void bno_dump_free(void *param); 280*1a3d31e3SAndroid Build Coastguard Worker void bno_dump_add(void *handle, struct io *iop); 281*1a3d31e3SAndroid Build Coastguard Worker void bno_dump_clean(void); 282*1a3d31e3SAndroid Build Coastguard Worker 283*1a3d31e3SAndroid Build Coastguard Worker /* plat.c */ 284*1a3d31e3SAndroid Build Coastguard Worker void *plat_alloc(struct d_info *dip, char *post); 285*1a3d31e3SAndroid Build Coastguard Worker void plat_free(void *info); 286*1a3d31e3SAndroid Build Coastguard Worker void plat_clean(void); 287*1a3d31e3SAndroid Build Coastguard Worker void plat_x2c(void *info, __u64 ts, __u64 latency); 288*1a3d31e3SAndroid Build Coastguard Worker 289*1a3d31e3SAndroid Build Coastguard Worker /* p_live.c */ 290*1a3d31e3SAndroid Build Coastguard Worker void *p_live_alloc(void); 291*1a3d31e3SAndroid Build Coastguard Worker void p_live_free(void *p); 292*1a3d31e3SAndroid Build Coastguard Worker void p_live_add(struct d_info *dip, __u64 dt, __u64 ct); 293*1a3d31e3SAndroid Build Coastguard Worker void p_live_exit(void); 294*1a3d31e3SAndroid Build Coastguard Worker struct p_live_info *p_live_get(struct d_info *dip, int base_y); 295*1a3d31e3SAndroid Build Coastguard Worker 296*1a3d31e3SAndroid Build Coastguard Worker /* q2d.c */ 297*1a3d31e3SAndroid Build Coastguard Worker void q2d_histo_add(void *priv, __u64 q2d); 298*1a3d31e3SAndroid Build Coastguard Worker void *q2d_alloc(void); 299*1a3d31e3SAndroid Build Coastguard Worker void q2d_free(void *priv); 300*1a3d31e3SAndroid Build Coastguard Worker void q2d_display_header(FILE *fp); 301*1a3d31e3SAndroid Build Coastguard Worker void q2d_display_dashes(FILE *fp); 302*1a3d31e3SAndroid Build Coastguard Worker void q2d_display(FILE *fp, void *priv); 303*1a3d31e3SAndroid Build Coastguard Worker int q2d_ok(void *priv); 304*1a3d31e3SAndroid Build Coastguard Worker void q2d_acc(void *a1, void *a2); 305*1a3d31e3SAndroid Build Coastguard Worker 306*1a3d31e3SAndroid Build Coastguard Worker /* rstats.c */ 307*1a3d31e3SAndroid Build Coastguard Worker void *rstat_alloc(struct d_info *dip); 308*1a3d31e3SAndroid Build Coastguard Worker void rstat_free(void *ptr); 309*1a3d31e3SAndroid Build Coastguard Worker void rstat_add(void *ptr, double cur, unsigned long long nblks); 310*1a3d31e3SAndroid Build Coastguard Worker int rstat_init(void); 311*1a3d31e3SAndroid Build Coastguard Worker void rstat_exit(void); 312*1a3d31e3SAndroid Build Coastguard Worker 313*1a3d31e3SAndroid Build Coastguard Worker /* seek.c */ 314*1a3d31e3SAndroid Build Coastguard Worker void *seeki_alloc(struct d_info *dip, char *post); 315*1a3d31e3SAndroid Build Coastguard Worker void seeki_free(void *param); 316*1a3d31e3SAndroid Build Coastguard Worker void seek_clean(void); 317*1a3d31e3SAndroid Build Coastguard Worker void seeki_add(void *handle, struct io *iop); 318*1a3d31e3SAndroid Build Coastguard Worker double seeki_mean(void *handle); 319*1a3d31e3SAndroid Build Coastguard Worker long long seeki_nseeks(void *handle); 320*1a3d31e3SAndroid Build Coastguard Worker long long seeki_median(void *handle); 321*1a3d31e3SAndroid Build Coastguard Worker int seeki_mode(void *handle, struct mode *mp); 322*1a3d31e3SAndroid Build Coastguard Worker 323*1a3d31e3SAndroid Build Coastguard Worker /* trace.c */ 324*1a3d31e3SAndroid Build Coastguard Worker void add_trace(struct io *iop); 325*1a3d31e3SAndroid Build Coastguard Worker 326*1a3d31e3SAndroid Build Coastguard Worker /* trace_complete.c */ 327*1a3d31e3SAndroid Build Coastguard Worker void trace_complete(struct io *c_iop); 328*1a3d31e3SAndroid Build Coastguard Worker 329*1a3d31e3SAndroid Build Coastguard Worker /* trace_im.c */ 330*1a3d31e3SAndroid Build Coastguard Worker void run_im(struct io *im_iop, struct io *d_iop, struct io *c_iop); 331*1a3d31e3SAndroid Build Coastguard Worker void run_unim(struct io *im_iop, struct io *d_iop, struct io *c_iop); 332*1a3d31e3SAndroid Build Coastguard Worker int ready_im(struct io *im_iop, struct io *c_iop); 333*1a3d31e3SAndroid Build Coastguard Worker void trace_insert(struct io *i_iop); 334*1a3d31e3SAndroid Build Coastguard Worker void trace_merge(struct io *m_iop); 335*1a3d31e3SAndroid Build Coastguard Worker void trace_getrq(struct io *g_iop); 336*1a3d31e3SAndroid Build Coastguard Worker void trace_sleeprq(struct io *s_iop); 337*1a3d31e3SAndroid Build Coastguard Worker 338*1a3d31e3SAndroid Build Coastguard Worker /* trace_issue.c */ 339*1a3d31e3SAndroid Build Coastguard Worker void run_issue(struct io *d_iop, struct io *u_iop, struct io *c_iop); 340*1a3d31e3SAndroid Build Coastguard Worker void run_unissue(struct io *d_iop, struct io *u_iop, struct io *c_iop); 341*1a3d31e3SAndroid Build Coastguard Worker int ready_issue(struct io *d_iop, struct io *c_iop); 342*1a3d31e3SAndroid Build Coastguard Worker void trace_issue(struct io *d_iop); 343*1a3d31e3SAndroid Build Coastguard Worker 344*1a3d31e3SAndroid Build Coastguard Worker /* trace_plug.c */ 345*1a3d31e3SAndroid Build Coastguard Worker void trace_plug(struct io *p_iop); 346*1a3d31e3SAndroid Build Coastguard Worker void trace_unplug_io(struct io *u_iop); 347*1a3d31e3SAndroid Build Coastguard Worker void trace_unplug_timer(struct io *u_iop); 348*1a3d31e3SAndroid Build Coastguard Worker 349*1a3d31e3SAndroid Build Coastguard Worker /* trace_queue.c */ 350*1a3d31e3SAndroid Build Coastguard Worker void run_queue(struct io *q_iop, struct io *u_iop, struct io *c_iop); 351*1a3d31e3SAndroid Build Coastguard Worker int ready_queue(struct io *q_iop, struct io *c_iop); 352*1a3d31e3SAndroid Build Coastguard Worker void trace_queue(struct io *q_iop); 353*1a3d31e3SAndroid Build Coastguard Worker 354*1a3d31e3SAndroid Build Coastguard Worker /* trace_remap.c */ 355*1a3d31e3SAndroid Build Coastguard Worker void run_remap(struct io *a_iop, struct io *u_iop, struct io *c_iop); 356*1a3d31e3SAndroid Build Coastguard Worker int ready_remap(struct io *a_iop, struct io *c_iop); 357*1a3d31e3SAndroid Build Coastguard Worker void trace_remap(struct io *a_iop); 358*1a3d31e3SAndroid Build Coastguard Worker 359*1a3d31e3SAndroid Build Coastguard Worker /* trace_requeue.c */ 360*1a3d31e3SAndroid Build Coastguard Worker void trace_requeue(struct io *r_iop); 361*1a3d31e3SAndroid Build Coastguard Worker 362*1a3d31e3SAndroid Build Coastguard Worker /* unplug_hist.c */ 363*1a3d31e3SAndroid Build Coastguard Worker void *unplug_hist_alloc(struct d_info *dip); 364*1a3d31e3SAndroid Build Coastguard Worker void unplug_hist_free(void *arg); 365*1a3d31e3SAndroid Build Coastguard Worker void unplug_hist_add(struct io *u_iop); 366*1a3d31e3SAndroid Build Coastguard Worker 367*1a3d31e3SAndroid Build Coastguard Worker #include "inlines.h" 368