diff options
author | Mikael Ronstrom <mikael@mysql.com> | 2009-03-06 13:31:03 +0100 |
---|---|---|
committer | Mikael Ronstrom <mikael@mysql.com> | 2009-03-06 13:31:03 +0100 |
commit | 5a5343d2e6c68740e10d2e03b11863e4c6a13a15 (patch) | |
tree | 38ce3e61e0bd8dff96dc8a0f9c706ee81c583af4 /support-files/dtrace/locktime.d | |
parent | bceddafd990b708bea02b5a2953fde20feff1f4e (diff) | |
download | mariadb-git-5a5343d2e6c68740e10d2e03b11863e4c6a13a15.tar.gz |
Added DTrace example scripts
Diffstat (limited to 'support-files/dtrace/locktime.d')
-rw-r--r-- | support-files/dtrace/locktime.d | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/support-files/dtrace/locktime.d b/support-files/dtrace/locktime.d new file mode 100644 index 00000000000..c9b509ca61e --- /dev/null +++ b/support-files/dtrace/locktime.d @@ -0,0 +1,49 @@ +#!/usr/sbin/dtrace -s +# +# Shows the time that an individual lock is applied to a database and table +# Shows the time to achieve the lock, and the time the table was locked + +o#pragma D option quiet + +mysql*:::handler-rdlock-start +{ + self->rdlockstart = timestamp; + this->lockref = strjoin(copyinstr(arg0),strjoin("@",copyinstr(arg1))); + self->lockmap[this->lockref] = self->rdlockstart; + printf("Start: Lock->Read %s.%s\n",copyinstr(arg0),copyinstr(arg1)); +} + +mysql*:::handler-wrlock-start +{ + self->wrlockstart = timestamp; + this->lockref = strjoin(copyinstr(arg0),strjoin("@",copyinstr(arg1))); + self->lockmap[this->lockref] = self->rdlockstart; + printf("Start: Lock->Write %s.%s\n",copyinstr(arg0),copyinstr(arg1)); +} + +mysql*:::handler-unlock-start +{ + self->unlockstart = timestamp; + this->lockref = strjoin(copyinstr(arg0),strjoin("@",copyinstr(arg1))); + printf("Start: Lock->Unlock %s.%s (%d ms lock duration)\n", + copyinstr(arg0),copyinstr(arg1), + (timestamp - self->lockmap[this->lockref])/1000000); +} + +mysql*:::handler-rdlock-done +{ + printf("End: Lock->Read %d ms\n", + (timestamp - self->rdlockstart)/1000000); +} + +mysql*:::handler-wrlock-done +{ + printf("End: Lock->Write %d ms\n", + (timestamp - self->wrlockstart)/1000000); +} + +mysql*:::handler-unlock-done +{ + printf("End: Lock->Unlock %d ms\n", + (timestamp - self->unlockstart)/1000000); +} |