Skip to content

Instantly share code, notes, and snippets.

@dotmanila
Last active November 29, 2015 06:34
Show Gist options
  • Save dotmanila/0f5dfdf08e2e07be107a to your computer and use it in GitHub Desktop.
Save dotmanila/0f5dfdf08e2e07be107a to your computer and use it in GitHub Desktop.
MySQL Thread Running "SELECT SLEEP(10)" via callgrind
# Ran with valgrind --tool=callgrind mysqld ...
# mysql -e 'select sleep(10)'
# callgrind_control -b
Frame: Backtrace for Thread 24
[ 0] pthread_cond_timedwait@@GLIBC_2.3.2 (1 x)
[ 1] Interruptible_wait::wait(st_mysql_cond*, st_mysql_mutex*) (1 x)
[ 2] Item_func_sleep::val_int() (1 x)
[ 3] Item::send(Protocol*, String*) (2 x)
[ 4] Protocol::send_result_set_row(List<Item>*) (2 x)
[ 5] select_send::send_data(List<Item>&) (2 x)
[ 6] JOIN::exec() (2 x)
[ 7] mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, SQL_I_List<st_order>*, SQL_I_List<st_order>*, Item*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (2 x)
[ 8] handle_select(THD*, select_result*, unsigned long) (2 x)
[ 9] execute_sqlcom_select(THD*, TABLE_LIST*) (2 x)
[10] mysql_execute_command(THD*) (2 x)
[11] mysql_parse(THD*, char*, unsigned int, Parser_state*) (2 x)
[12] dispatch_command(enum_server_command, THD*, char*, unsigned int) (2 x)
[13] do_command(THD*) (2 x)
[14] do_handle_one_connection(THD*) (1 x)
[15] handle_one_connection (1 x)
[16] pfs_spawn_thread (2 x)
[17] start_thread (23 x)
[18] clone
# mysqld shutting down
Frame: Backtrace for Thread 25
[ 0] os_event_free(os_event*) (4499836 x)
[ 1] os_sync_free() (1 x)
[ 2] innobase_shutdown_for_mysql() (1 x)
[ 3] innobase_end(handlerton*, ha_panic_function) (1 x)
[ 4] ha_finalize_handlerton(st_plugin_int*) (5 x)
[ 5] reap_plugins() (2 x)
[ 6] plugin_shutdown() (1 x)
[ 7] clean_up(bool) [clone .part.183] (1 x)
[ 8] unireg_end() (1 x)
[ 9] kill_server(void*) [clone .constprop.217] (1 x)
[10] kill_server_thread (1 x)
[11] pfs_spawn_thread (1 x)
[12] start_thread (1 x)
[13] clone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment