#!/usr/sbin/dtrace -qs # run as ./count_deadlock_walks.d `pgrep -x mysqld` # Created by Harrison Fisk (harrison dot fisk@sun.com) # http://bugs.mysql.com/49047 # this requires a low optimization compiled mysqld, otherwise lock_rec_get_prev is inlined by the compiler # I used mysqld-debug for my tests of the counts pid$1::lock_rec_get_prev:entry { @calls[probefunc] = count(); } pid$1::*mysql_parse*:entry { @total_queries = count(); } dtrace:::END { printa("%s %@4d\n", @calls); printa("Total queries: %@d", @total_queries); }