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
commit 66dfd85cf4
33 changed files with 976 additions and 134 deletions

View file

@ -151,7 +151,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
}
}
thd->proc_info="System lock";
THD_PROC_INFO(thd, "System lock");
if (lock_external(thd, tables, count))
{
/* Clear the lock type of all lock data to avoid reusage. */
@ -160,7 +160,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
sql_lock=0;
break;
}
thd->proc_info="Table lock";
THD_PROC_INFO(thd, "Table lock");
thd->locked=1;
/* Copy the lock data array. thr_multi_lock() reorders its contens. */
memcpy(sql_lock->locks + sql_lock->lock_count, sql_lock->locks,
@ -194,7 +194,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
thd->locked=0;
break;
}
thd->proc_info=0;
THD_PROC_INFO(thd, 0);
/* some table was altered or deleted. reopen tables marked deleted */
mysql_unlock_tables(thd,sql_lock);
@ -209,7 +209,7 @@ retry:
if (wait_for_tables(thd))
break; // Couldn't open tables
}
thd->proc_info=0;
THD_PROC_INFO(thd, 0);
if (thd->killed)
{
thd->send_kill_message();