diff options
author | Brian Behlendorf <[email protected]> | 2012-10-22 16:57:27 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-11-02 15:17:40 -0700 |
commit | dba79fcbf2cc50be5caef84ae01657e884ac5d89 (patch) | |
tree | 45071c65d0cf08c261574edb09aff0401e919a5e /include | |
parent | 71c9f0b00307e6ee703eef9eba91e7640731c458 (diff) |
Add KSTAT_TYPE_TXG type
Add a new kstat type for tracking useful statistics about a TXG.
The new KSTAT_TYPE_TXG type can be used to tracks the following
statistics per-txg.
txg - Unique txg number
state - State (O)pen/(Q)uiescing/(S)yncing/(C)ommitted
birth; - Creation time
nread - Bytes read
nwritten; - Bytes written
reads - IOPs read
writes - IOPs write
open_time; - Length in nanoseconds the txg was open
quiesce_time - Length in nanoseconds the txg was quiescing
sync_time; - Length in nanoseconds the txg was syncing
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/kstat.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/sys/kstat.h b/include/sys/kstat.h index 45386d49a..06379f827 100644 --- a/include/sys/kstat.h +++ b/include/sys/kstat.h @@ -43,7 +43,8 @@ #define KSTAT_TYPE_INTR 2 /* interrupt stats; ks_ndata == 1 */ #define KSTAT_TYPE_IO 3 /* I/O stats; ks_ndata == 1 */ #define KSTAT_TYPE_TIMER 4 /* event timer; ks_ndata >= 1 */ -#define KSTAT_NUM_TYPES 5 +#define KSTAT_TYPE_TXG 5 /* txg sync; ks_ndata >= 1 */ +#define KSTAT_NUM_TYPES 6 #define KSTAT_DATA_CHAR 0 #define KSTAT_DATA_INT32 1 @@ -156,6 +157,26 @@ typedef struct kstat_timer { hrtime_t stop_time; /* previous event stop time */ } kstat_timer_t; +typedef enum kstat_txg_state { + TXG_STATE_OPEN = 1, + TXG_STATE_QUIESCING = 2, + TXG_STATE_SYNCING = 3, + TXG_STATE_COMMITTED = 4, +} kstat_txg_state_t; + +typedef struct kstat_txg { + u_longlong_t txg; /* txg id */ + kstat_txg_state_t state; /* txg state */ + hrtime_t birth; /* birth time stamp */ + u_longlong_t nread; /* number of bytes read */ + u_longlong_t nwritten; /* number of bytes written */ + uint_t reads; /* number of read operations */ + uint_t writes; /* number of write operations */ + hrtime_t open_time; /* open time */ + hrtime_t quiesce_time;/* quiesce time */ + hrtime_t sync_time; /* sync time */ +} kstat_txg_t; + int spl_kstat_init(void); void spl_kstat_fini(void); |