summaryrefslogtreecommitdiffstats
path: root/module/zfs/dmu_tx.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-10-02 11:43:52 -0700
committerBrian Behlendorf <[email protected]>2013-10-25 13:57:25 -0700
commit2d37239a28b8b2ddc0e8312093f8d8810c6351fa (patch)
tree93885704a95285d91b28baca4df8fe57ea3efcf5 /module/zfs/dmu_tx.c
parent0b1401ee911c5a0c0bdb7a8e6ad36840cea3af24 (diff)
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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/zfs/dmu_tx.c')
-rw-r--r--module/zfs/dmu_tx.c5
1 files changed, 5 insertions, 0 deletions
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);
}