This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem in tuning mysql code use systemtap


i try to tuning mysql code use systemtap, and mysql debuginfo is installed

$ rpm -qa|grep Percona.*debuginfo
Percona-Server-55-debuginfo-5.5.20-rel24.1.217.rhel5

here is probe point which i choose

$ stap -L 'process("/usr/sbin/mysqld").function("*")'|grep mysql_execute_command
process("/usr/sbin/mysqld").function("mysql_execute_command@/usr/src/debug/Percona-Server-5.5.20-rel24.1/Percona-Server-5.5.20-rel24.1/sql/sql_parse.cc:1991")
$thd:struct THD*

so i use $$parms$ see  elements in struct THD , here is output

 thd={.prev=0x2aaacc2aaa90, .next=0x147146f0, .free_list=0x0,
.mem_root=0x1537d1e8, .state=3, .id=0, .mark_used_columns=1,
.name={...}, .lex=0x1537c030, .query_string={...}, .db="pharmnet",
.db_length=8, .m_reprepare_observer=0x0, .open_tables=0x0,
.temporary_tables=0x0, .LOCK_temporary_tables={...},
.derived_tables=0x0, .lock=0x0, .extra_lock=0x0,
.locked_tables_mode=0, .current_tablenr=1, .state_flags=0,
.mdl_context={...}, .rli_fake=0x0, .query_without_comments={...},
.query_cache_tls={...}, .net={...},

and i choose query_string for looking ,and here is my script

function __get_sql:string (thd:long){
        my_sql = thd
           ? (@defined(@cast(thd, "THD")->query_string)
                ? @cast(thd, "THD")->query_string
                : "NOTHING")
           : "NO Thread"
        return my_sql
}

probe process("/usr/sbin/mysqld").function("mysql_execute_command").return {
        myh = __get_sql($thd)
        printf(" %p : %s \n",$thd,myh)
}

compile is fine,but output is not expected ,why?

 0x1537a460 : NOTHING
 0x1537a460 : NOTHING
 0x1537a460 : NOTHING
 0x1537a460 : NOTHING
 0x1537a460 : NOTHING


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]