1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +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:
unknown
2007-01-03 17:15:10 -05:00
parent 96fa010c66
commit 66dfd85cf4
33 changed files with 976 additions and 134 deletions

View File

@@ -167,7 +167,7 @@ int mysql_update(THD *thd,
mysql_handle_derived(thd->lex, &mysql_derived_filling)))
DBUG_RETURN(1);
thd->proc_info="init";
THD_PROC_INFO(thd, "init");
table= table_list->table;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
@@ -359,7 +359,7 @@ int mysql_update(THD *thd,
else
init_read_record_idx(&info, thd, table, 1, used_index);
thd->proc_info="Searching rows for update";
THD_PROC_INFO(thd, "Searching rows for update");
uint tmp_limit= limit;
while (!(error=info.read_record(&info)) && !thd->killed)
@@ -424,7 +424,7 @@ int mysql_update(THD *thd,
updated= found= 0;
thd->count_cuted_fields= CHECK_FIELD_WARN; /* calc cuted fields */
thd->cuted_fields=0L;
thd->proc_info="Updating";
THD_PROC_INFO(thd, "Updating");
query_id=thd->query_id;
transactional_table= table->file->has_transactions();
@@ -512,7 +512,7 @@ int mysql_update(THD *thd,
end_read_record(&info);
free_io_cache(table); // If ORDER BY
delete select;
thd->proc_info="end";
THD_PROC_INFO(thd, "end");
VOID(table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY));
/*
@@ -960,7 +960,7 @@ int multi_update::prepare(List<Item> &not_used_values,
thd->count_cuted_fields= CHECK_FIELD_WARN;
thd->cuted_fields=0L;
thd->proc_info="updating main table";
THD_PROC_INFO(thd, "updating main table");
tables_to_update= get_table_map(fields);
@@ -1512,11 +1512,11 @@ err2:
bool multi_update::send_eof()
{
char buff[STRING_BUFFER_USUAL_SIZE];
thd->proc_info="updating reference tables";
THD_PROC_INFO(thd, "updating reference tables");
/* Does updates for the last n - 1 tables, returns 0 if ok */
int local_error = (table_count) ? do_updates(0) : 0;
thd->proc_info= "end";
THD_PROC_INFO(thd, "end");
/* We must invalidate the query cache before binlog writing and
ha_autocommit_... */