#!/usr/sbin/dtrace -qs /* * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. * * lockstimesi.d - Display lock wait times grouped by fileid. * * This script graphs the time spent waiting for DB page locks. * * The optional integer maxcount parameter directs the script to exit once that * many page lock waits have been measured. * * usage: locktimesid.d { -p | -c " [suspend = timestamp; } /* lock-resume(DBT *lockobj, db_lockmode_t lock_mode) */ bdb$target:::lock-resume /self->suspend > 0/ { this->duration = timestamp - self->suspend; self->suspend = 0; this->dbt = copyin(arg0, sizeof(struct __db_dbt)); this->ilock = copyin(this->dbt->data, sizeof(DB_ILOCK)); @locktimes[this->ilock->fileid, this->ilock->pgno, arg1] = quantize(this->duration); lockcount++ } bdb$target:::lock-resume /lockcount == maxcount/ { exit(0); } dtrace:::END { /* This example uses the default display format for @locktimes. */ }