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