1 /*	$OpenBSD: rf_acctrace.h,v 1.3 2002/12/16 07:01:03 tdeval Exp $	*/
2 /*	$NetBSD: rf_acctrace.h,v 1.3 1999/02/05 00:06:06 oster Exp $	*/
3 
4 /*
5  * Copyright (c) 1995 Carnegie-Mellon University.
6  * All rights reserved.
7  *
8  * Author: Mark Holland
9  *
10  * Permission to use, copy, modify and distribute this software and
11  * its documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  *
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * Carnegie Mellon requests users of this software to return to
21  *
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  *
27  * any improvements or extensions that they make and grant Carnegie the
28  * rights to redistribute these changes.
29  */
30 
31 /*****************************************************************************
32  *
33  * acctrace.h -- Header file for acctrace.c
34  *
35  *****************************************************************************/
36 
37 
38 #ifndef	_RF__RF_ACCTRACE_H_
39 #define	_RF__RF_ACCTRACE_H_
40 
41 #include "rf_types.h"
42 #include "rf_hist.h"
43 #include "rf_etimer.h"
44 
45 typedef struct RF_user_acc_stats_s {
46 	RF_uint64	suspend_ovhd_us;/*
47 					 * usec spent mucking in the
48 					 * access-suspension code.
49 					 */
50 	RF_uint64	map_us;		/* usec spent mapping the access. */
51 	RF_uint64	lock_us;	/*
52 					 * usec spent locking & unlocking
53 					 * stripes, including time spent
54 					 * blocked.
55 					 */
56 	RF_uint64	dag_create_us;	/* usec spent creating the DAGs. */
57 	RF_uint64	dag_retry_us;	/*
58 					 * _total_ usec spent retrying the op
59 					 * -- not broken down into components.
60 					 */
61 	RF_uint64	exec_us;	/* usec spent in DispatchDAG. */
62 	RF_uint64	exec_engine_us;	/*
63 					 * usec spent in engine, not including
64 					 * blocking time.
65 					 */
66 	RF_uint64	cleanup_us;	/*
67 					 * usec spent tearing down the dag &
68 					 * maps, and generally cleaning up.
69 					 */
70 } RF_user_acc_stats_t;
71 
72 typedef struct RF_recon_acc_stats_s {
73 	RF_uint32	recon_start_to_fetch_us;
74 	RF_uint32	recon_fetch_to_return_us;
75 	RF_uint32	recon_return_to_submit_us;
76 } RF_recon_acc_stats_t;
77 
78 typedef struct RF_acctrace_entry_s {
79 	union {
80 		RF_user_acc_stats_t	user;
81 		RF_recon_acc_stats_t	recon;
82 	}		specific;
83 	RF_uint8	reconacc;	/*
84 					 * Whether this is a tracerec for a
85 					 * user acc or a recon acc.
86 					 */
87 	RF_uint64	xor_us;		/* usec spent doing XORs. */
88 	RF_uint64	q_us;		/* usec spent doing XORs. */
89 	RF_uint64	plog_us;	/*
90 					 * usec spent waiting to stuff parity
91 					 * into log.
92 					 */
93 	RF_uint64	diskqueue_us;	/*
94 					 * _total_ usec spent in disk queue(s),
95 					 * incl concurrent ops.
96 					 */
97 	RF_uint64	diskwait_us;	/*
98 					 * _total_ usec spent actually waiting
99 					 * on the disk, incl concurrent ops.
100 					 */
101 	RF_uint64	total_us;	/* Total usec spent on this access. */
102 	RF_uint64	num_phys_ios;	/* Number of physical I/Os invoked. */
103 	RF_uint64	phys_io_us;	/* Time of physical I/O. */
104 	RF_Etimer_t	tot_timer;	/*
105 					 * A timer used to compute total
106 					 * access time.
107 					 */
108 	RF_Etimer_t	timer;		/*
109 					 * A generic timer val for timing
110 					 * events that live across procedure
111 					 * boundaries.
112 					 */
113 	RF_Etimer_t	recon_timer;	/* Generic timer for recon stuff. */
114 	RF_uint64	index;
115 } RF_AccTraceEntry_t;
116 
117 typedef struct RF_AccTotals_s {
118 	/* User acc stats. */
119 	RF_uint64	suspend_ovhd_us;
120 	RF_uint64	map_us;
121 	RF_uint64	lock_us;
122 	RF_uint64	dag_create_us;
123 	RF_uint64	dag_retry_us;
124 	RF_uint64	exec_us;
125 	RF_uint64	exec_engine_us;
126 	RF_uint64	cleanup_us;
127 	RF_uint64	user_reccount;
128 	/* Recon acc stats. */
129 	RF_uint64	recon_start_to_fetch_us;
130 	RF_uint64	recon_fetch_to_return_us;
131 	RF_uint64	recon_return_to_submit_us;
132 	RF_uint64	recon_io_overflow_count;
133 	RF_uint64	recon_phys_io_us;
134 	RF_uint64	recon_num_phys_ios;
135 	RF_uint64	recon_diskwait_us;
136 	RF_uint64	recon_reccount;
137 	/* Trace entry stats. */
138 	RF_uint64	xor_us;
139 	RF_uint64	q_us;
140 	RF_uint64	plog_us;
141 	RF_uint64	diskqueue_us;
142 	RF_uint64	diskwait_us;
143 	RF_uint64	total_us;
144 	RF_uint64	num_log_ents;
145 	RF_uint64	phys_io_overflow_count;
146 	RF_uint64	num_phys_ios;
147 	RF_uint64	phys_io_us;
148 	RF_uint64	bigvals;
149 	/* Histograms. */
150 	RF_Hist_t	dw_hist[RF_HIST_NUM_BUCKETS];
151 	RF_Hist_t	tot_hist[RF_HIST_NUM_BUCKETS];
152 } RF_AccTotals_t;
153 
154 #if	RF_UTILITY == 0
155 RF_DECLARE_EXTERN_MUTEX(rf_tracing_mutex);
156 #endif	/* RF_UTILITY == 0 */
157 
158 int  rf_ConfigureAccessTrace(RF_ShutdownList_t **);
159 void rf_LogTraceRec(RF_Raid_t * raid, RF_AccTraceEntry_t *);
160 void rf_FlushAccessTraceBuf(void);
161 
162 #endif	/* !_RF__RF_ACCTRACE_H_ */
163