From 55d5af733d97808a1479b185c029ac0121c0f158 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 15 Apr 2015 11:29:01 +0400 Subject: MDEV-7945 - THD::enter_stage() takes 0.48% in OLTP RO THD::enter_stage() optimizations: - stage backup code moved to THD::backup_stage(), saves one condition - moved check for "new_stage" out to callers that actually need it - remnants of enter_stage() moved to sql_class.h so it can be inlined THD::enter_stage() overhead dropped 0.48% -> 0.07%. PROFILING::status_change() optimizations: - "status_arg" is now checked by QUERY_PROFILE::new_status() - no need to check "enabled": !enabled && current is impossible - remnants of status_change() moved to sql_profile.h so it can be inlined PROFILING::status_change() overhead dropped 0.1% -> out of radar. --- sql/sql_profile.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sql/sql_profile.h') diff --git a/sql/sql_profile.h b/sql/sql_profile.h index f8970bb162a..52eaba49181 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -278,7 +278,14 @@ public: void status_change(const char *status_arg, const char *function_arg, - const char *file_arg, unsigned int line_arg); + const char *file_arg, unsigned int line_arg) + { + if (unlikely(current)) + { + DBUG_ASSERT(enabled); + current->new_status(status_arg, function_arg, file_arg, line_arg); + } + } inline void set_thd(THD *thd_arg) { thd= thd_arg; }; -- cgit v1.2.1