diff options
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); +} |