summaryrefslogtreecommitdiffstats
path: root/lib/libspl
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2012-10-23 13:48:22 -0700
committerBrian Behlendorf <[email protected]>2012-11-02 15:45:56 -0700
commite95853a331529a6cb96fdf10476c53441e59f4e1 (patch)
tree30f0809324bb570d1e97ccbee054f1f0484d4668 /lib/libspl
parente8fd45a0f975c6b8ae8cd644714fc21f14fac2bf (diff)
Add txgs-<pool> kstat file
Create a kstat file which contains useful statistics about the last N txgs processed. This can be helpful when analyzing pool performance. The new KSTAT_TYPE_TXG type was added for this purpose and it 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 'lib/libspl')
-rw-r--r--lib/libspl/include/sys/kstat.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/libspl/include/sys/kstat.h b/lib/libspl/include/sys/kstat.h
index fcd3ed98b..6bd2ec878 100644
--- a/lib/libspl/include/sys/kstat.h
+++ b/lib/libspl/include/sys/kstat.h
@@ -228,8 +228,10 @@ typedef struct kstat32 {
/* ks_ndata == 1 */
#define KSTAT_TYPE_TIMER 4 /* event timer */
/* ks_ndata >= 1 */
+#define KSTAT_TYPE_TXG 5 /* txg statistics */
+ /* ks_ndata >= 0 */
-#define KSTAT_NUM_TYPES 5
+#define KSTAT_NUM_TYPES 6
/*
* kstat class
@@ -698,6 +700,29 @@ typedef struct kstat_timer {
#define KSTAT_TIMER_PTR(kptr) ((kstat_timer_t *)(kptr)->ks_data)
+/*
+ * TXG statistics - bytes read/written and iops performed
+ */
+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;
+
#if defined(_KERNEL)
#include <sys/t_lock.h>