Thursday, June 21, 2012

gprof data for MySQL client/server

This post aims to provide detailed
steps to get gprof data for MySQL client and server.

Compile time options:

During compilation option
-DENABLE_GPROF=1 is
supposed to be set which would make it possible to collect gprof data for mysql cleint/server.

Thing to be keep in mind that this
option doesn't have any effect if it is issued -DWITH_DEBUG=1
during compilation. The reason for this is, gprof aims to be enabled
only for optimized non-debug linux builds.

Platform:

This option works only for linux
platform.

Collecting gprof data:

Once compilation is done, change
directory to place where MySQL is installed (path given in
-DCMAKE_INSTALL_PREFIX
option or /usr/local/mysql
by default).

Following are the steps to collect
gprof data. Start mysql server on a shell: