diff options
Diffstat (limited to 'sql/sql_profile.cc')
-rw-r--r-- | sql/sql_profile.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index a169823e25e..f3b62991c5c 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -329,13 +329,27 @@ PROFILING::PROFILING() PROFILING::~PROFILING() { + restart(); +} + +/* + Restart profiling from scratch +*/ + +void PROFILING::restart() +{ while (! history.is_empty()) delete history.pop(); if (current != NULL) delete current; + /* Ensure that profiling object can be reused */ + profile_id_counter= 1; + current= NULL; + last= NULL; } + /** Throw away the current profile, because it's useless or unwanted or corrupted. @@ -675,6 +689,6 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond void PROFILING::reset() { - enabled= thd->variables.option_bits & OPTION_PROFILING; + enabled= (thd->variables.option_bits & OPTION_PROFILING) != 0; } #endif /* ENABLED_PROFILING */ |