From 2d37239a28b8b2ddc0e8312093f8d8810c6351fa Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 2 Oct 2013 11:43:52 -0700 Subject: Add visibility in to dmu_tx_assign times This change adds a new kstat to gain some visibility into the amount of time spent in each call to dmu_tx_assign. A histogram is exported via the new dmu_tx_assign file. The information contained in this histogram is the frequency dmu_tx_assign took to complete given an interval range. Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf --- module/zfs/dmu_tx.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'module/zfs/dmu_tx.c') diff --git a/module/zfs/dmu_tx.c b/module/zfs/dmu_tx.c index 17982a04e..7b6223956 100644 --- a/module/zfs/dmu_tx.c +++ b/module/zfs/dmu_tx.c @@ -1077,12 +1077,15 @@ dmu_tx_unassign(dmu_tx_t *tx) int dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how) { + hrtime_t before; int err; ASSERT(tx->tx_txg == 0); ASSERT(txg_how == TXG_WAIT || txg_how == TXG_NOWAIT); ASSERT(!dsl_pool_sync_context(tx->tx_pool)); + before = gethrtime(); + /* If we might wait, we must not hold the config lock. */ ASSERT(txg_how != TXG_WAIT || !dsl_pool_config_held(tx->tx_pool)); @@ -1097,6 +1100,8 @@ dmu_tx_assign(dmu_tx_t *tx, txg_how_t txg_how) txg_rele_to_quiesce(&tx->tx_txgh); + spa_tx_assign_add_nsecs(tx->tx_pool->dp_spa, gethrtime() - before); + return (0); } -- cgit v1.2.3