Tracing mysqld Using SystemTap

615 views Asked by At

I wanna use systemtap to trace MySQL.
The problem is, after MySQL is configured and built and I start the server, I can't get the markers info that are present in the server:

[root@localhost]$ stap -l 'process("/home/mysql/mysql5.5.33/bin/mysqld").mark("*")'
[root@localhost]$ (nothing ouput)

My env as follows:

1 stap version
$ stap --version
Systemtap translator/driver (version 1.7/0.152 non-git sources)
Copyright (C) 2005-2012 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: AVAHI LIBRPM LIBSQLITE3 NSS BOOST_SHARED_PTR TR1_UNORDERED_MAP NLS

2 I configure MySQL using script as follows:

cmake \
-DCMAKE_INSTALL_PREFIX=/home/mysql/mysql5.6.12 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLED_DTRACE=1 \
-DWITH_DEBUG=1 \

BTW:I can get function output
[root@localhost] stap -L 'process("/home/mysql/mysql5.6.12/bin/mysqld").function("main")'
process("/home/mysql/mysql5.6.12/bin/mysqld").function("main@/home/mysql/mysql-5.6.12/sql/main.cc:23") $argc:int $argv:char**

readelf -n /home/mysql/mysql5.6.12/bin/mysqld
`Notes at offset 0x0000021c with length 0x00000020:
Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)

Notes at offset 0x0000023c with length 0x00000024:
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)`

1

There are 1 answers

0
fche On

It seems that the -DENABLED_DTRACE=1 bits for mysql were not enough to actually compile in the sys/sdt.h instrumentation. If they did, you'd have seen extra data in readelf. You might try looking at the individual .o files in the mysql build tree. For example, Fedora 19's mariadb-server package does have the markers:

% stap -L 'process("/usr/libexec/mysqld").mark("*")'
process("/usr/libexec/mysqld").mark("command__done") $arg1:long
...54 lines omitted...
process("/usr/libexec/mysqld").mark("update__start") $arg1:long

And there it is configured with -DENABLE_DTRACE=ON. Perhaps yours is just a -DENABLED_DTRACE vs -DENABLE_DTRACE typo?