mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#24795: Add SHOW PROFILE
Patch contributed by Jeremy Cole. CLA received Oct 2006 by Kaj Arnö Add rudimentary query profiling support. libmysqld/Makefile.am: Add profile file to source list. sql/Makefile.am: Add profiling files to source and header lists. sql/ha_archive.cc: Macro-ized other discovered instances of setting proc_info. sql/ha_myisam.cc: Macroize setting thread-state info sql/item_func.cc: Macro-ized other discovered instances of setting proc_info. sql/lex.h: Add lexer info for profiling. sql/lock.cc: Macroize setting thread-state info sql/log_event.cc: Macro-ized other discovered instances of setting proc_info. sql/mysql_priv.h: Set constants for profiling. sql/repl_failsafe.cc: Macro-ized other discovered instances of setting proc_info. sql/slave.cc: Macro-ized other discovered instances of setting proc_info. sql/sp_head.cc: Macro-ized other discovered instances of setting proc_info. sql/sql_base.cc: Macroize setting thread-state info --- Macro-ized other discovered instances of setting proc_info. sql/sql_cache.cc: Macroize setting thread-state info sql/sql_class.cc: Integrate profiling. sql/sql_class.h: Instantiate profiling object. sql/sql_delete.cc: Macroize setting thread-state info sql/sql_insert.cc: Macroize setting thread-state info --- Macro-ized other discovered instances of setting proc_info. sql/sql_lex.cc: Initialize profiling. sql/sql_lex.h: Define lex tokens and allocate space for profiling options. sql/sql_parse.cc: Integrate profiling. --- Macro-ized other discovered instances of setting proc_info. sql/sql_repl.cc: Macro-ized other discovered instances of setting proc_info. sql/sql_select.cc: Macroize setting thread-state info. Clean up some lines. sql/sql_show.cc: Macro-ized other discovered instances of setting proc_info. --- Revert bad use of macro. sql/sql_table.cc: Macroize setting thread-state info sql/sql_update.cc: Macroize setting thread-state info sql/sql_view.cc: Macro-ized other discovered instances of setting proc_info. sql/sql_yacc.yy: Add parser info for profiling. --- Fix new YACC shift/reduce conflict. (Now at 249.) mysql-test/r/profile.result: Test profiling code. --- A not-very-useful result. mysql-test/t/profile.test: Test profiling code. --- Test syntax, but not values of profiles code. sql/sql_profile.cc: Add profiling code. --- Add wishlist comment. sql/sql_profile.h: Add profiling code. --- Changed the value of the macro so that it's syntactically equivalent to a single statement.
This commit is contained in:
@ -309,7 +309,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
|
||||
*/
|
||||
thd->mysys_var->current_mutex= &LOCK_open;
|
||||
thd->mysys_var->current_cond= &COND_refresh;
|
||||
thd->proc_info="Flushing tables";
|
||||
THD_PROC_INFO(thd, "Flushing tables");
|
||||
|
||||
close_old_data_files(thd,thd->open_tables,1,1);
|
||||
mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL,
|
||||
@ -351,7 +351,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
|
||||
pthread_mutex_lock(&thd->mysys_var->mutex);
|
||||
thd->mysys_var->current_mutex= 0;
|
||||
thd->mysys_var->current_cond= 0;
|
||||
thd->proc_info=0;
|
||||
THD_PROC_INFO(thd, 0);
|
||||
pthread_mutex_unlock(&thd->mysys_var->mutex);
|
||||
}
|
||||
DBUG_RETURN(result);
|
||||
@ -1065,7 +1065,7 @@ void wait_for_refresh(THD *thd)
|
||||
thd->mysys_var->current_mutex= &LOCK_open;
|
||||
thd->mysys_var->current_cond= &COND_refresh;
|
||||
proc_info=thd->proc_info;
|
||||
thd->proc_info="Waiting for table";
|
||||
THD_PROC_INFO(thd, "Waiting for table");
|
||||
if (!thd->killed)
|
||||
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
|
||||
|
||||
@ -1073,7 +1073,7 @@ void wait_for_refresh(THD *thd)
|
||||
pthread_mutex_lock(&thd->mysys_var->mutex);
|
||||
thd->mysys_var->current_mutex= 0;
|
||||
thd->mysys_var->current_cond= 0;
|
||||
thd->proc_info= proc_info;
|
||||
THD_PROC_INFO(thd, proc_info);
|
||||
pthread_mutex_unlock(&thd->mysys_var->mutex);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -1778,7 +1778,7 @@ bool wait_for_tables(THD *thd)
|
||||
bool result;
|
||||
DBUG_ENTER("wait_for_tables");
|
||||
|
||||
thd->proc_info="Waiting for tables";
|
||||
THD_PROC_INFO(thd, "Waiting for tables");
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
while (!thd->killed)
|
||||
{
|
||||
@ -1794,12 +1794,12 @@ bool wait_for_tables(THD *thd)
|
||||
else
|
||||
{
|
||||
/* Now we can open all tables without any interference */
|
||||
thd->proc_info="Reopen tables";
|
||||
THD_PROC_INFO(thd, "Reopen tables");
|
||||
thd->version= refresh_version;
|
||||
result=reopen_tables(thd,0,0);
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
thd->proc_info=0;
|
||||
THD_PROC_INFO(thd, 0);
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
@ -2098,7 +2098,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
restart:
|
||||
*counter= 0;
|
||||
query_tables_last_own= 0;
|
||||
thd->proc_info="Opening tables";
|
||||
THD_PROC_INFO(thd, "Opening tables");
|
||||
|
||||
/*
|
||||
If we are not already executing prelocked statement and don't have
|
||||
@ -2278,7 +2278,7 @@ process_view_routines:
|
||||
}
|
||||
|
||||
err:
|
||||
thd->proc_info=0;
|
||||
THD_PROC_INFO(thd, 0);
|
||||
free_root(&new_frm_mem, MYF(0)); // Free pre-alloced block
|
||||
|
||||
if (query_tables_last_own)
|
||||
@ -2352,7 +2352,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
|
||||
bool refresh;
|
||||
DBUG_ENTER("open_ltable");
|
||||
|
||||
thd->proc_info="Opening table";
|
||||
THD_PROC_INFO(thd, "Opening table");
|
||||
thd->current_tablenr= 0;
|
||||
/* open_ltable can be used only for BASIC TABLEs */
|
||||
table_list->required_type= FRMTYPE_TABLE;
|
||||
@ -2386,7 +2386,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
|
||||
table= 0;
|
||||
}
|
||||
}
|
||||
thd->proc_info=0;
|
||||
THD_PROC_INFO(thd, 0);
|
||||
DBUG_RETURN(table);
|
||||
}
|
||||
|
||||
@ -5387,7 +5387,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
|
||||
List_iterator<Item_func_match> li(*(select_lex->ftfunc_list));
|
||||
Item_func_match *ifm;
|
||||
DBUG_PRINT("info",("Performing FULLTEXT search"));
|
||||
thd->proc_info="FULLTEXT initialization";
|
||||
THD_PROC_INFO(thd, "FULLTEXT initialization");
|
||||
|
||||
while ((ifm=li++))
|
||||
ifm->init_search(no_order);
|
||||
|
Reference in New Issue
Block a user