2012-08-09 17:22:00 +02:00
|
|
|
/* Copyright (c) 2007, 2012, Oracle and/or its affiliates.
|
|
|
|
Copyright (c) 2008, 2012, Monty Program Ab
|
2007-01-03 23:15:10 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-02-26 19:11:36 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2007-01-03 23:15:10 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2019-05-11 20:29:06 +02:00
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
2007-01-03 23:15:10 +01:00
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
/**
|
|
|
|
@file
|
|
|
|
|
|
|
|
Implement query profiling as as list of metaphorical fences, with one fence
|
|
|
|
per query, and each fencepost a change of thd->proc_info state (with a
|
|
|
|
snapshot of system statistics). When asked, we can then iterate over the
|
|
|
|
fenceposts and calculate the distance between them, to inform the user what
|
|
|
|
happened during a particular query or thd->proc_info state.
|
|
|
|
|
|
|
|
User variables that inform profiling behavior:
|
|
|
|
- "profiling", boolean, session only, "Are queries profiled?"
|
|
|
|
- "profiling_history_size", integer, session + global, "Num queries stored?"
|
|
|
|
*/
|
|
|
|
|
2017-06-18 05:42:16 +02:00
|
|
|
#include "mariadb.h"
|
2010-03-31 16:05:33 +02:00
|
|
|
#include "sql_priv.h"
|
|
|
|
#include "sql_profile.h"
|
2019-06-16 05:51:59 +02:00
|
|
|
#include "sql_i_s.h" // schema_table_store_record
|
2010-03-31 16:05:33 +02:00
|
|
|
#include "sql_class.h" // THD
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
2011-11-26 23:07:53 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
#pragma comment(lib,"psapi.lib")
|
|
|
|
#endif
|
|
|
|
|
2007-03-02 15:14:33 +01:00
|
|
|
#define TIME_FLOAT_DIGITS 9
|
2009-10-15 23:38:29 +02:00
|
|
|
/** two vals encoded: (len*100)+dec */
|
2007-11-13 15:46:17 +01:00
|
|
|
#define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3)
|
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#define MAX_QUERY_LENGTH 300
|
2012-10-12 19:38:45 +02:00
|
|
|
#define MAX_QUERY_HISTORY 101
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
Connects Information_Schema and Profiling.
|
|
|
|
*/
|
2007-11-09 20:45:44 +01:00
|
|
|
int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables,
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
Item *cond)
|
|
|
|
{
|
2009-10-09 15:59:25 +02:00
|
|
|
#if defined(ENABLED_PROFILING)
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
return(thd->profiling.fill_statistics_info(thd, tables, cond));
|
|
|
|
#else
|
2007-11-02 16:41:58 +01:00
|
|
|
my_error(ER_FEATURE_DISABLED, MYF(0), "SHOW PROFILE", "enable-profiling");
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
return(1);
|
|
|
|
#endif
|
|
|
|
}
|
2007-01-03 23:15:10 +01:00
|
|
|
|
2019-06-16 05:51:59 +02:00
|
|
|
namespace Show {
|
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
ST_FIELD_INFO query_profile_statistics_info[]=
|
|
|
|
{
|
2019-06-16 05:51:59 +02:00
|
|
|
Column("QUERY_ID", SLong(20), NOT_NULL, "Query_id"),
|
|
|
|
Column("SEQ", SLong(20), NOT_NULL, "Seq"),
|
|
|
|
Column("STATE", Varchar(30), NOT_NULL, "Status"),
|
|
|
|
Column("DURATION", Decimal(TIME_I_S_DECIMAL_SIZE), NOT_NULL, "Duration"),
|
|
|
|
Column("CPU_USER", Decimal(TIME_I_S_DECIMAL_SIZE), NULLABLE, "CPU_user"),
|
|
|
|
Column("CPU_SYSTEM", Decimal(TIME_I_S_DECIMAL_SIZE), NULLABLE, "CPU_system"),
|
|
|
|
Column("CONTEXT_VOLUNTARY", SLong(20), NULLABLE, "Context_voluntary"),
|
|
|
|
Column("CONTEXT_INVOLUNTARY", SLong(20), NULLABLE, "Context_involuntary"),
|
|
|
|
Column("BLOCK_OPS_IN", SLong(20), NULLABLE, "Block_ops_in"),
|
|
|
|
Column("BLOCK_OPS_OUT", SLong(20), NULLABLE, "Block_ops_out"),
|
|
|
|
Column("MESSAGES_SENT", SLong(20), NULLABLE, "Messages_sent"),
|
|
|
|
Column("MESSAGES_RECEIVED", SLong(20), NULLABLE, "Messages_received"),
|
|
|
|
Column("PAGE_FAULTS_MAJOR", SLong(20), NULLABLE, "Page_faults_major"),
|
|
|
|
Column("PAGE_FAULTS_MINOR", SLong(20), NULLABLE, "Page_faults_minor"),
|
|
|
|
Column("SWAPS", SLong(20), NULLABLE, "Swaps"),
|
|
|
|
Column("SOURCE_FUNCTION", Varchar(30), NULLABLE, "Source_function"),
|
|
|
|
Column("SOURCE_FILE", Varchar(20), NULLABLE, "Source_file"),
|
|
|
|
Column("SOURCE_LINE", SLong(20), NULLABLE, "Source_line"),
|
|
|
|
CEnd()
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
};
|
|
|
|
|
2019-06-16 05:51:59 +02:00
|
|
|
} // namespace Show
|
2007-07-02 13:27:39 +02:00
|
|
|
|
|
|
|
int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|
|
|
{
|
2012-06-29 13:25:57 +02:00
|
|
|
uint profile_options = thd->lex->profile_options;
|
|
|
|
uint fields_include_condition_truth_values[]= {
|
2007-07-02 13:27:39 +02:00
|
|
|
FALSE, /* Query_id */
|
|
|
|
FALSE, /* Seq */
|
|
|
|
TRUE, /* Status */
|
|
|
|
TRUE, /* Duration */
|
|
|
|
profile_options & PROFILE_CPU, /* CPU_user */
|
|
|
|
profile_options & PROFILE_CPU, /* CPU_system */
|
|
|
|
profile_options & PROFILE_CONTEXT, /* Context_voluntary */
|
|
|
|
profile_options & PROFILE_CONTEXT, /* Context_involuntary */
|
|
|
|
profile_options & PROFILE_BLOCK_IO, /* Block_ops_in */
|
|
|
|
profile_options & PROFILE_BLOCK_IO, /* Block_ops_out */
|
|
|
|
profile_options & PROFILE_IPC, /* Messages_sent */
|
|
|
|
profile_options & PROFILE_IPC, /* Messages_received */
|
|
|
|
profile_options & PROFILE_PAGE_FAULTS, /* Page_faults_major */
|
|
|
|
profile_options & PROFILE_PAGE_FAULTS, /* Page_faults_minor */
|
|
|
|
profile_options & PROFILE_SWAPS, /* Swaps */
|
|
|
|
profile_options & PROFILE_SOURCE, /* Source_function */
|
|
|
|
profile_options & PROFILE_SOURCE, /* Source_file */
|
|
|
|
profile_options & PROFILE_SOURCE, /* Source_line */
|
|
|
|
};
|
|
|
|
|
|
|
|
ST_FIELD_INFO *field_info;
|
2018-05-22 19:08:39 +02:00
|
|
|
Name_resolution_context *context= &thd->lex->first_select_lex()->context;
|
2007-07-02 13:27:39 +02:00
|
|
|
int i;
|
|
|
|
|
2019-06-22 07:15:37 +02:00
|
|
|
for (i= 0; !schema_table->fields_info[i].end_marker(); i++)
|
2007-07-02 13:27:39 +02:00
|
|
|
{
|
|
|
|
if (! fields_include_condition_truth_values[i])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
field_info= &schema_table->fields_info[i];
|
2015-08-20 14:24:13 +02:00
|
|
|
Item_field *field= new (thd->mem_root) Item_field(thd, context,
|
2019-06-22 07:15:37 +02:00
|
|
|
field_info->name());
|
2007-07-02 13:27:39 +02:00
|
|
|
if (field)
|
|
|
|
{
|
2019-06-22 07:15:37 +02:00
|
|
|
field->set_name(thd, field_info->old_name());
|
2007-07-02 13:27:39 +02:00
|
|
|
if (add_item_to_list(thd, field))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-09 15:59:25 +02:00
|
|
|
#if defined(ENABLED_PROFILING)
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
|
|
|
#define RUSAGE_USEC(tv) ((tv).tv_sec*1000*1000 + (tv).tv_usec)
|
2007-01-03 23:15:10 +01:00
|
|
|
#define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2)))
|
|
|
|
|
2010-02-05 13:57:15 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
static ULONGLONG FileTimeToQuadWord(FILETIME *ft)
|
|
|
|
{
|
|
|
|
// Overlay FILETIME onto a ULONGLONG.
|
|
|
|
union {
|
|
|
|
ULONGLONG qwTime;
|
|
|
|
FILETIME ft;
|
|
|
|
} u;
|
|
|
|
|
|
|
|
u.ft = *ft;
|
|
|
|
return u.qwTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get time difference between to FILETIME objects in seconds.
|
|
|
|
static double GetTimeDiffInSeconds(FILETIME *a, FILETIME *b)
|
|
|
|
{
|
|
|
|
return ((FileTimeToQuadWord(a) - FileTimeToQuadWord(b)) / 1e7);
|
|
|
|
}
|
|
|
|
#endif
|
2007-01-03 23:15:10 +01:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
PROF_MEASUREMENT::PROF_MEASUREMENT(QUERY_PROFILE *profile_arg, const char
|
|
|
|
*status_arg)
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
:profile(profile_arg)
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
|
|
|
collect();
|
2007-11-09 20:45:44 +01:00
|
|
|
set_label(status_arg, NULL, NULL, 0);
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
PROF_MEASUREMENT::PROF_MEASUREMENT(QUERY_PROFILE *profile_arg,
|
|
|
|
const char *status_arg,
|
|
|
|
const char *function_arg,
|
|
|
|
const char *file_arg,
|
|
|
|
unsigned int line_arg)
|
2007-01-03 23:15:10 +01:00
|
|
|
:profile(profile_arg)
|
|
|
|
{
|
|
|
|
collect();
|
2007-11-09 20:45:44 +01:00
|
|
|
set_label(status_arg, function_arg, file_arg, line_arg);
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
PROF_MEASUREMENT::~PROF_MEASUREMENT()
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
|
|
|
my_free(allocated_status_memory);
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
status= function= file= NULL;
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
2007-11-09 20:45:44 +01:00
|
|
|
|
|
|
|
void PROF_MEASUREMENT::set_label(const char *status_arg,
|
|
|
|
const char *function_arg,
|
|
|
|
const char *file_arg, unsigned int line_arg)
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
size_t sizes[3]; /* 3 == status+function+file */
|
|
|
|
char *cursor;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Compute all the space we'll need to allocate one block for everything
|
|
|
|
we'll need, instead of N mallocs.
|
|
|
|
*/
|
2007-02-26 19:11:36 +01:00
|
|
|
sizes[0]= (status_arg == NULL) ? 0 : strlen(status_arg) + 1;
|
|
|
|
sizes[1]= (function_arg == NULL) ? 0 : strlen(function_arg) + 1;
|
|
|
|
sizes[2]= (file_arg == NULL) ? 0 : strlen(file_arg) + 1;
|
2007-11-09 20:45:44 +01:00
|
|
|
|
2020-01-29 13:50:26 +01:00
|
|
|
allocated_status_memory= (char *) my_malloc(key_memory_PROFILE, sizes[0] +
|
|
|
|
sizes[1] + sizes[2], MYF(0));
|
2023-09-27 13:55:39 +02:00
|
|
|
if (!allocated_status_memory)
|
|
|
|
return;
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
|
|
|
cursor= allocated_status_memory;
|
|
|
|
|
|
|
|
if (status_arg != NULL)
|
|
|
|
{
|
|
|
|
strcpy(cursor, status_arg);
|
|
|
|
status= cursor;
|
|
|
|
cursor+= sizes[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
status= NULL;
|
|
|
|
|
|
|
|
if (function_arg != NULL)
|
|
|
|
{
|
|
|
|
strcpy(cursor, function_arg);
|
|
|
|
function= cursor;
|
|
|
|
cursor+= sizes[1];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
function= NULL;
|
|
|
|
|
|
|
|
if (file_arg != NULL)
|
|
|
|
{
|
|
|
|
strcpy(cursor, file_arg);
|
|
|
|
file= cursor;
|
|
|
|
cursor+= sizes[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
file= NULL;
|
|
|
|
|
|
|
|
line= line_arg;
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
/**
|
|
|
|
This updates the statistics for this moment of time. It captures the state
|
|
|
|
of the running system, so later we can compare points in time and infer what
|
|
|
|
happened in the mean time. It should only be called immediately upon
|
|
|
|
instantiation of this PROF_MEASUREMENT.
|
|
|
|
|
|
|
|
@todo Implement resource capture for OSes not like BSD.
|
|
|
|
*/
|
|
|
|
void PROF_MEASUREMENT::collect()
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
2011-05-19 19:05:35 +02:00
|
|
|
time_usecs= my_interval_timer() / 1e3; /* ns to us */
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#ifdef HAVE_GETRUSAGE
|
2007-01-03 23:15:10 +01:00
|
|
|
getrusage(RUSAGE_SELF, &rusage);
|
2010-02-05 13:57:15 +01:00
|
|
|
#elif defined(_WIN32)
|
|
|
|
FILETIME ftDummy;
|
|
|
|
// NOTE: Get{Process|Thread}Times has a granularity of the clock interval,
|
|
|
|
// which is typically ~15ms. So intervals shorter than that will not be
|
|
|
|
// measurable by this function.
|
|
|
|
GetProcessTimes(GetCurrentProcess(), &ftDummy, &ftDummy, &ftKernel, &ftUser);
|
2010-01-29 19:42:22 +01:00
|
|
|
GetProcessIoCounters(GetCurrentProcess(), &io_count);
|
|
|
|
GetProcessMemoryInfo(GetCurrentProcess(), &mem_count, sizeof(mem_count));
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#endif
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg)
|
|
|
|
:profiling(profiling_arg), profiling_query_id(0), query_source(NULL)
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
2012-10-12 19:38:45 +02:00
|
|
|
m_seq_counter= 1;
|
|
|
|
PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg);
|
2023-09-27 13:55:39 +02:00
|
|
|
if (!prof)
|
|
|
|
return;
|
2012-10-12 19:38:45 +02:00
|
|
|
prof->m_seq= m_seq_counter++;
|
|
|
|
m_start_time_usecs= prof->time_usecs;
|
|
|
|
m_end_time_usecs= m_start_time_usecs;
|
|
|
|
entries.push_back(prof);
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QUERY_PROFILE::~QUERY_PROFILE()
|
|
|
|
{
|
2007-04-03 23:59:52 +02:00
|
|
|
while (! entries.is_empty())
|
|
|
|
delete entries.pop();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
|
|
|
my_free(query_source);
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
/**
|
|
|
|
@todo Provide a way to include the full text, as in SHOW PROCESSLIST.
|
|
|
|
*/
|
2018-02-06 13:55:58 +01:00
|
|
|
void QUERY_PROFILE::set_query_source(char *query_source_arg, size_t query_length_arg)
|
2007-11-09 20:45:44 +01:00
|
|
|
{
|
|
|
|
/* Truncate to avoid DoS attacks. */
|
2018-02-06 13:55:58 +01:00
|
|
|
size_t length= MY_MIN(MAX_QUERY_LENGTH, query_length_arg);
|
2007-11-09 20:45:44 +01:00
|
|
|
|
|
|
|
DBUG_ASSERT(query_source == NULL); /* we don't leak memory */
|
|
|
|
if (query_source_arg != NULL)
|
2020-01-29 13:50:26 +01:00
|
|
|
query_source= my_strndup(key_memory_PROFILE, query_source_arg, length, MYF(0));
|
2007-11-09 20:45:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void QUERY_PROFILE::new_status(const char *status_arg,
|
|
|
|
const char *function_arg, const char *file_arg,
|
|
|
|
unsigned int line_arg)
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
2007-11-09 20:45:44 +01:00
|
|
|
PROF_MEASUREMENT *prof;
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
DBUG_ENTER("QUERY_PROFILE::status");
|
2007-01-03 23:15:10 +01:00
|
|
|
|
2015-04-15 09:29:01 +02:00
|
|
|
if (!status_arg)
|
|
|
|
DBUG_VOID_RETURN;
|
2007-01-03 23:15:10 +01:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
if ((function_arg != NULL) && (file_arg != NULL))
|
2011-07-20 08:50:47 +02:00
|
|
|
prof= new PROF_MEASUREMENT(this, status_arg, function_arg, base_name(file_arg), line_arg);
|
2007-11-09 20:45:44 +01:00
|
|
|
else
|
|
|
|
prof= new PROF_MEASUREMENT(this, status_arg);
|
2023-09-27 13:55:39 +02:00
|
|
|
if (!prof)
|
|
|
|
DBUG_VOID_RETURN;
|
2007-01-03 23:15:10 +01:00
|
|
|
|
2012-10-12 19:38:45 +02:00
|
|
|
prof->m_seq= m_seq_counter++;
|
|
|
|
m_end_time_usecs= prof->time_usecs;
|
2007-11-09 20:45:44 +01:00
|
|
|
entries.push_back(prof);
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
2012-10-12 19:38:45 +02:00
|
|
|
/* Maintain the query history size. */
|
|
|
|
while (entries.elements > MAX_QUERY_HISTORY)
|
|
|
|
delete entries.pop();
|
|
|
|
|
2007-01-03 23:15:10 +01:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
2007-01-03 23:15:10 +01:00
|
|
|
|
|
|
|
PROFILING::PROFILING()
|
2007-11-09 20:45:44 +01:00
|
|
|
:profile_id_counter(1), current(NULL), last(NULL)
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
PROFILING::~PROFILING()
|
2016-04-07 18:51:40 +02:00
|
|
|
{
|
|
|
|
restart();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Restart profiling from scratch
|
|
|
|
*/
|
|
|
|
|
|
|
|
void PROFILING::restart()
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
2007-04-03 23:59:52 +02:00
|
|
|
while (! history.is_empty())
|
|
|
|
delete history.pop();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
|
|
|
if (current != NULL)
|
|
|
|
delete current;
|
2016-04-07 18:51:40 +02:00
|
|
|
/* Ensure that profiling object can be reused */
|
|
|
|
profile_id_counter= 1;
|
|
|
|
current= NULL;
|
|
|
|
last= NULL;
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
|
|
|
|
2016-04-07 18:51:40 +02:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
/**
|
|
|
|
Throw away the current profile, because it's useless or unwanted
|
|
|
|
or corrupted.
|
|
|
|
*/
|
|
|
|
void PROFILING::discard_current_query()
|
|
|
|
{
|
|
|
|
DBUG_ENTER("PROFILING::discard_current_profile");
|
|
|
|
|
|
|
|
delete current;
|
|
|
|
current= NULL;
|
2007-04-04 01:50:55 +02:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Try to save the current profile entry, clean up the data if it shouldn't be
|
|
|
|
saved, and maintain the profile history size. Naturally, this may not
|
|
|
|
succeed if the profile was previously discarded, and that's expected.
|
|
|
|
*/
|
2015-04-15 16:12:23 +02:00
|
|
|
void PROFILING::finish_current_query_impl()
|
2007-11-09 20:45:44 +01:00
|
|
|
{
|
|
|
|
DBUG_ENTER("PROFILING::finish_current_profile");
|
2015-04-15 16:12:23 +02:00
|
|
|
DBUG_ASSERT(current);
|
|
|
|
|
|
|
|
/* The last fence-post, so we can support the span before this. */
|
|
|
|
status_change("ending", NULL, NULL, 0);
|
|
|
|
|
|
|
|
if (enabled && /* ON at end? */
|
|
|
|
(current->query_source != NULL) &&
|
|
|
|
(! current->entries.is_empty()))
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
2015-04-15 16:12:23 +02:00
|
|
|
current->profiling_query_id= next_profile_id(); /* assign an id */
|
2007-11-09 20:45:44 +01:00
|
|
|
|
2015-04-15 16:12:23 +02:00
|
|
|
history.push_back(current);
|
|
|
|
last= current; /* never contains something that is not in the history. */
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
2015-04-15 16:12:23 +02:00
|
|
|
/* Maintain the history size. */
|
|
|
|
while (history.elements > thd->variables.profiling_history_size)
|
|
|
|
delete history.pop();
|
2007-01-03 23:15:10 +01:00
|
|
|
}
|
2015-04-15 16:12:23 +02:00
|
|
|
else
|
|
|
|
delete current;
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
2015-04-15 16:12:23 +02:00
|
|
|
current= NULL;
|
2007-01-03 23:15:10 +01:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool PROFILING::show_profiles()
|
|
|
|
{
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
QUERY_PROFILE *prof;
|
2007-01-03 23:15:10 +01:00
|
|
|
List<Item> field_list;
|
2015-08-20 14:24:13 +02:00
|
|
|
MEM_ROOT *mem_root= thd->mem_root;
|
2018-05-22 19:08:39 +02:00
|
|
|
SELECT_LEX *sel= thd->lex->first_select_lex();
|
2007-01-03 23:15:10 +01:00
|
|
|
SELECT_LEX_UNIT *unit= &thd->lex->unit;
|
2019-09-26 09:49:50 +02:00
|
|
|
ha_rows idx;
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
Protocol *protocol= thd->protocol;
|
2015-08-24 13:42:07 +02:00
|
|
|
void *iterator;
|
|
|
|
DBUG_ENTER("PROFILING::show_profiles");
|
|
|
|
|
|
|
|
field_list.push_back(new (mem_root)
|
|
|
|
Item_return_int(thd, "Query_ID", 10,
|
|
|
|
MYSQL_TYPE_LONG),
|
|
|
|
mem_root);
|
|
|
|
field_list.push_back(new (mem_root)
|
|
|
|
Item_return_int(thd, "Duration",
|
|
|
|
TIME_FLOAT_DIGITS - 1,
|
|
|
|
MYSQL_TYPE_DOUBLE),
|
|
|
|
mem_root);
|
|
|
|
field_list.push_back(new (mem_root) Item_empty_string(thd, "Query", 40),
|
|
|
|
mem_root);
|
|
|
|
|
|
|
|
if (protocol->send_result_set_metadata(&field_list,
|
|
|
|
Protocol::SEND_NUM_ROWS |
|
|
|
|
Protocol::SEND_EOF))
|
|
|
|
DBUG_RETURN(TRUE);
|
2007-01-03 23:15:10 +01:00
|
|
|
|
|
|
|
unit->set_limit(sel);
|
2007-11-09 20:45:44 +01:00
|
|
|
|
2019-09-26 09:49:50 +02:00
|
|
|
for (iterator= history.new_iterator(), idx= 1;
|
2007-11-09 20:45:44 +01:00
|
|
|
iterator != NULL;
|
2019-09-26 09:49:50 +02:00
|
|
|
iterator= history.iterator_next(iterator), idx++)
|
2007-01-03 23:15:10 +01:00
|
|
|
{
|
2007-04-03 23:59:52 +02:00
|
|
|
prof= history.iterator_value(iterator);
|
|
|
|
|
2012-10-12 19:38:45 +02:00
|
|
|
double query_time_usecs= prof->m_end_time_usecs - prof->m_start_time_usecs;
|
2007-01-03 23:15:10 +01:00
|
|
|
|
2019-10-11 12:26:15 +02:00
|
|
|
if (unit->lim.check_offset(idx))
|
2007-01-03 23:15:10 +01:00
|
|
|
continue;
|
2019-09-26 09:49:50 +02:00
|
|
|
if (idx > unit->lim.get_select_limit())
|
2007-01-03 23:15:10 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
protocol->prepare_for_resend();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
protocol->store((uint32)(prof->profiling_query_id));
|
2020-07-23 12:48:04 +02:00
|
|
|
protocol->store_double(query_time_usecs/(1000.0*1000),
|
|
|
|
(uint32) TIME_FLOAT_DIGITS-1);
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
if (prof->query_source != NULL)
|
2007-11-09 20:45:44 +01:00
|
|
|
protocol->store(prof->query_source, strlen(prof->query_source),
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
system_charset_info);
|
|
|
|
else
|
|
|
|
protocol->store_null();
|
2007-11-09 20:45:44 +01:00
|
|
|
|
2007-01-03 23:15:10 +01:00
|
|
|
if (protocol->write())
|
|
|
|
DBUG_RETURN(TRUE);
|
|
|
|
}
|
2008-02-19 21:47:15 +01:00
|
|
|
my_eof(thd);
|
2007-01-03 23:15:10 +01:00
|
|
|
DBUG_RETURN(FALSE);
|
|
|
|
}
|
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
/**
|
|
|
|
Fill the information schema table, "query_profile", as defined in show.cc .
|
2007-07-02 13:27:39 +02:00
|
|
|
There are two ways to get to this function: Selecting from the information
|
2007-11-09 20:45:44 +01:00
|
|
|
schema, and a SHOW command.
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
*/
|
2010-03-14 17:01:45 +01:00
|
|
|
int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond)
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
{
|
|
|
|
DBUG_ENTER("PROFILING::fill_statistics_info");
|
|
|
|
TABLE *table= tables->table;
|
|
|
|
ulonglong row_number= 0;
|
|
|
|
|
|
|
|
QUERY_PROFILE *query;
|
|
|
|
/* Go through each query in this thread's stored history... */
|
2007-04-03 23:59:52 +02:00
|
|
|
void *history_iterator;
|
2007-11-09 20:45:44 +01:00
|
|
|
for (history_iterator= history.new_iterator();
|
|
|
|
history_iterator != NULL;
|
2007-04-03 23:59:52 +02:00
|
|
|
history_iterator= history.iterator_next(history_iterator))
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
{
|
2007-04-03 23:59:52 +02:00
|
|
|
query= history.iterator_value(history_iterator);
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Because we put all profiling info into a table that may be reordered, let
|
|
|
|
us also include a numbering of each state per query. The query_id and
|
|
|
|
the "seq" together are unique.
|
|
|
|
*/
|
2012-10-12 19:38:45 +02:00
|
|
|
ulong seq;
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
2007-04-03 23:59:52 +02:00
|
|
|
void *entry_iterator;
|
2007-11-09 20:45:44 +01:00
|
|
|
PROF_MEASUREMENT *entry, *previous= NULL;
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
/* ...and for each query, go through all its state-change steps. */
|
2012-10-12 19:38:45 +02:00
|
|
|
for (entry_iterator= query->entries.new_iterator();
|
2007-11-09 20:45:44 +01:00
|
|
|
entry_iterator != NULL;
|
2007-04-03 23:59:52 +02:00
|
|
|
entry_iterator= query->entries.iterator_next(entry_iterator),
|
2012-10-12 19:38:45 +02:00
|
|
|
previous=entry, row_number++)
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
{
|
2007-04-03 23:59:52 +02:00
|
|
|
entry= query->entries.iterator_value(entry_iterator);
|
2012-10-12 19:38:45 +02:00
|
|
|
seq= entry->m_seq;
|
2007-04-03 23:59:52 +02:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
/* Skip the first. We count spans of fence, not fence-posts. */
|
|
|
|
if (previous == NULL) continue;
|
|
|
|
|
2010-03-14 17:01:45 +01:00
|
|
|
if (thd_arg->lex->sql_command == SQLCOM_SHOW_PROFILE)
|
2007-07-02 13:27:39 +02:00
|
|
|
{
|
2007-11-09 20:45:44 +01:00
|
|
|
/*
|
2007-07-02 13:27:39 +02:00
|
|
|
We got here via a SHOW command. That means that we stored
|
|
|
|
information about the query we wish to show and that isn't
|
|
|
|
in a WHERE clause at a higher level to filter out rows we
|
|
|
|
wish to exclude.
|
|
|
|
|
|
|
|
Because that functionality isn't available in the server yet,
|
|
|
|
we must filter here, at the wrong level. Once one can con-
|
|
|
|
struct where and having conditions at the SQL layer, then this
|
|
|
|
condition should be ripped out.
|
|
|
|
*/
|
2010-03-14 17:01:45 +01:00
|
|
|
if (thd_arg->lex->profile_query_id == 0) /* 0 == show final query */
|
2007-07-02 13:27:39 +02:00
|
|
|
{
|
|
|
|
if (query != last)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-03-14 17:01:45 +01:00
|
|
|
if (thd_arg->lex->profile_query_id != query->profiling_query_id)
|
2007-07-02 13:27:39 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
/* Set default values for this row. */
|
|
|
|
restore_record(table, s->default_values);
|
|
|
|
|
|
|
|
/*
|
|
|
|
The order of these fields is set by the query_profile_statistics_info
|
|
|
|
array.
|
|
|
|
*/
|
2009-01-12 17:17:15 +01:00
|
|
|
table->field[0]->store((ulonglong) query->profiling_query_id, TRUE);
|
|
|
|
table->field[1]->store((ulonglong) seq, TRUE); /* the step in the sequence */
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
/*
|
|
|
|
This entry, n, has a point in time, T(n), and a status phrase, S(n).
|
|
|
|
The status phrase S(n) describes the period of time that begins at
|
|
|
|
T(n). The previous status phrase S(n-1) describes the period of time
|
|
|
|
that starts at T(n-1) and ends at T(n). Since we want to describe the
|
|
|
|
time that a status phrase took T(n)-T(n-1), this line must describe the
|
|
|
|
previous status.
|
|
|
|
*/
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[2]->store(previous->status, strlen(previous->status),
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
system_charset_info);
|
2007-07-03 18:20:19 +02:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
my_decimal duration_decimal;
|
|
|
|
double2my_decimal(E_DEC_FATAL_ERROR,
|
2007-07-03 18:20:19 +02:00
|
|
|
(entry->time_usecs-previous->time_usecs)/(1000.0*1000),
|
2007-11-09 20:45:44 +01:00
|
|
|
&duration_decimal);
|
|
|
|
|
|
|
|
table->field[3]->store_decimal(&duration_decimal);
|
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
my_decimal cpu_utime_decimal, cpu_stime_decimal;
|
|
|
|
|
|
|
|
double2my_decimal(E_DEC_FATAL_ERROR,
|
|
|
|
RUSAGE_DIFF_USEC(entry->rusage.ru_utime,
|
2007-07-03 18:20:19 +02:00
|
|
|
previous->rusage.ru_utime) /
|
|
|
|
(1000.0*1000),
|
2007-11-09 20:45:44 +01:00
|
|
|
&cpu_utime_decimal);
|
2007-07-03 18:20:19 +02:00
|
|
|
|
2007-11-09 20:45:44 +01:00
|
|
|
double2my_decimal(E_DEC_FATAL_ERROR,
|
2007-07-03 18:20:19 +02:00
|
|
|
RUSAGE_DIFF_USEC(entry->rusage.ru_stime,
|
2007-11-09 20:45:44 +01:00
|
|
|
previous->rusage.ru_stime) /
|
2007-07-03 18:20:19 +02:00
|
|
|
(1000.0*1000),
|
2007-11-09 20:45:44 +01:00
|
|
|
&cpu_stime_decimal);
|
2007-07-03 18:20:19 +02:00
|
|
|
|
2010-02-05 13:57:15 +01:00
|
|
|
table->field[4]->store_decimal(&cpu_utime_decimal);
|
|
|
|
table->field[5]->store_decimal(&cpu_stime_decimal);
|
|
|
|
table->field[4]->set_notnull();
|
|
|
|
table->field[5]->set_notnull();
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
my_decimal cpu_utime_decimal, cpu_stime_decimal;
|
|
|
|
|
|
|
|
double2my_decimal(E_DEC_FATAL_ERROR,
|
|
|
|
GetTimeDiffInSeconds(&entry->ftUser,
|
|
|
|
&previous->ftUser),
|
|
|
|
&cpu_utime_decimal);
|
|
|
|
double2my_decimal(E_DEC_FATAL_ERROR,
|
|
|
|
GetTimeDiffInSeconds(&entry->ftKernel,
|
|
|
|
&previous->ftKernel),
|
|
|
|
&cpu_stime_decimal);
|
|
|
|
|
|
|
|
// Store the result.
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[4]->store_decimal(&cpu_utime_decimal);
|
|
|
|
table->field[5]->store_decimal(&cpu_stime_decimal);
|
2007-07-03 18:20:19 +02:00
|
|
|
table->field[4]->set_notnull();
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[5]->set_notnull();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#else
|
|
|
|
/* TODO: Add CPU-usage info for non-BSD systems */
|
|
|
|
#endif
|
2007-11-09 20:45:44 +01:00
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#ifdef HAVE_GETRUSAGE
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[6]->store((uint32)(entry->rusage.ru_nvcsw -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_nvcsw));
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[6]->set_notnull();
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[7]->store((uint32)(entry->rusage.ru_nivcsw -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_nivcsw));
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[7]->set_notnull();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#else
|
|
|
|
/* TODO: Add context switch info for non-BSD systems */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[8]->store((uint32)(entry->rusage.ru_inblock -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_inblock));
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[8]->set_notnull();
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[9]->store((uint32)(entry->rusage.ru_oublock -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_oublock));
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[9]->set_notnull();
|
2010-01-29 19:42:22 +01:00
|
|
|
#elif defined(__WIN__)
|
|
|
|
ULONGLONG reads_delta = entry->io_count.ReadOperationCount -
|
|
|
|
previous->io_count.ReadOperationCount;
|
|
|
|
ULONGLONG writes_delta = entry->io_count.WriteOperationCount -
|
|
|
|
previous->io_count.WriteOperationCount;
|
|
|
|
|
|
|
|
table->field[8]->store((uint32)reads_delta);
|
|
|
|
table->field[8]->set_notnull();
|
|
|
|
|
|
|
|
table->field[9]->store((uint32)writes_delta);
|
|
|
|
table->field[9]->set_notnull();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#else
|
|
|
|
/* TODO: Add block IO info for non-BSD systems */
|
|
|
|
#endif
|
2007-11-09 20:45:44 +01:00
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#ifdef HAVE_GETRUSAGE
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[10]->store((uint32)(entry->rusage.ru_msgsnd -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_msgsnd), true);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[10]->set_notnull();
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[11]->store((uint32)(entry->rusage.ru_msgrcv -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_msgrcv), true);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[11]->set_notnull();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#else
|
|
|
|
/* TODO: Add message info for non-BSD systems */
|
|
|
|
#endif
|
2007-11-09 20:45:44 +01:00
|
|
|
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#ifdef HAVE_GETRUSAGE
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[12]->store((uint32)(entry->rusage.ru_majflt -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_majflt), true);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[12]->set_notnull();
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[13]->store((uint32)(entry->rusage.ru_minflt -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_minflt), true);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[13]->set_notnull();
|
2010-01-29 19:42:22 +01:00
|
|
|
#elif defined(__WIN__)
|
|
|
|
/* Windows APIs don't easily distinguish between hard and soft page
|
|
|
|
faults, so we just fill the 'major' column and leave the second NULL.
|
|
|
|
*/
|
|
|
|
table->field[12]->store((uint32)(entry->mem_count.PageFaultCount -
|
|
|
|
previous->mem_count.PageFaultCount), true);
|
|
|
|
table->field[12]->set_notnull();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#else
|
|
|
|
/* TODO: Add page fault info for non-BSD systems */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_GETRUSAGE
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[14]->store((uint32)(entry->rusage.ru_nswap -
|
Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
for each step
Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time. It
has no status description, as those are set by state changes and no
such point has yet been encountered. That profiling entry is not
in the list of entries generated when we change states.
The profiling code had the problem that each step of printing
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong. The label/
state refers to the period beginning with that profiling data, not
ending with it.
Now, give a label to the first profiling pseudo-entry, so that we
have a name to assign to the period that ends with the first state
change. Now also use the state name of the previous step in showing
the delta values that end with this step.
sql/sql_profile.cc:
Store a status of "initializing" whenever we construct the first
profile entry -- the one that gets reset whenever we're starting
a new query, before the server sets a real status.
Additionally, associate the previous status with the time period
that ends with the current profile entry's stats.
Since we need yet another piece of info from the previous profiling
entry, take out the piecemeal ways we currently do it and make a
general pointer to the whole thing.
2007-04-04 01:45:28 +02:00
|
|
|
previous->rusage.ru_nswap), true);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[14]->set_notnull();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#else
|
|
|
|
/* TODO: Add swap info for non-BSD systems */
|
|
|
|
#endif
|
2007-11-09 20:45:44 +01:00
|
|
|
|
|
|
|
/* Emit the location that started this step, not that ended it. */
|
|
|
|
if ((previous->function != NULL) && (previous->file != NULL))
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
{
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[15]->store(previous->function, strlen(previous->function),
|
|
|
|
system_charset_info);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[15]->set_notnull();
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[16]->store(previous->file, strlen(previous->file), system_charset_info);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[16]->set_notnull();
|
2007-11-09 20:45:44 +01:00
|
|
|
table->field[17]->store(previous->line, true);
|
2007-02-26 19:11:36 +01:00
|
|
|
table->field[17]->set_notnull();
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
}
|
|
|
|
|
2010-03-14 17:01:45 +01:00
|
|
|
if (schema_table_store_record(thd_arg, table))
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
DBUG_RETURN(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
2015-04-15 16:12:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
void PROFILING::reset()
|
|
|
|
{
|
2016-04-07 18:51:40 +02:00
|
|
|
enabled= (thd->variables.option_bits & OPTION_PROFILING) != 0;
|
2015-04-15 16:12:23 +02:00
|
|
|
}
|
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE
Profiling is only partially functional on some architectures. Where
there is no getrusage() system call, presently Null values are
returned where it would be required. Notably, Windows needs some love
applied to make it as useful.
Syntax this adds:
SHOW PROFILES
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
where "n" is an integer
and "types" is zero or many (comma-separated) of
"CPU"
"MEMORY" (not presently supported)
"BLOCK IO"
"CONTEXT SWITCHES"
"PAGE FAULTS"
"IPC"
"SWAPS"
"SOURCE"
"ALL"
It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by
default.
This patch abstracts setting THDs' "proc_info" behind a macro that
can be used as a hook into the profiling code when profiling
support is compiled in. All future code in this line should use
that mechanism for setting thd->proc_info.
---
Tests are now set to omit the statistics.
---
Adds an Information_schema table, "profiling" for access to
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.
Updated test results.
---
Include more thorough profiling tests.
Improve support for prepared statements.
Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
BitKeeper/deleted/.del-profile.result:
Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
Add a configure-time option to enable/disable query profiling. The
default is enabled.
include/my_dbug.h:
DBUG_* statements should be syntactically equivalent to a single
statement.
myisam/mi_open.c:
DBUG_* statements should be syntactically equivalent to a single
statement.
mysql-test/r/information_schema.result:
Updated (re-recorded) tests that I missed somehow. I verified these
for correctness.
mysql-test/r/information_schema_db.result:
Updated test results I missed.
mysql-test/r/mysqlshow.result:
Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_archive.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_berkeley.cc:
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/ha_ndbcluster.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_cmpfunc.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
sql/item_func.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/lock.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/log_event.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/mysql_priv.h:
Use 64-bit constants for the 64-bit bit field.
Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
Add semicolon to DBUG statement.
Add a new system variable and set it.
---
Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/set_var.cc:
Make a new system global variable and session variable, to determine
behavior of profiling.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/set_var.h:
The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_base.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
DBUG_* statements should be syntactically equivalent to a single
statement.
---
Fix merge problems.
sql/sql_class.cc:
Insert a pointer to the current thread in the profiling code.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_class.h:
Create a new system variable, profiling_history_size, and add a
member to THD to hold profiling information about this thread's
execution.
---
Manual merge, undoing first patch.
sql/sql_delete.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_lex.cc:
Initialize profiling options to empty.
---
Manual merge, undoing first patch.
sql/sql_lex.h:
Add info to the lexer object so that we can hold data that comes from
parsing statements.
Reuse memory addresses of uints that can't occur in the same state-
ment.
This is dangerous because it involves knowledge of what symbols are
never used together, which is information stored obliquely in another
file.
---
Manual merge, undoing first patch.
sql/sql_parse.cc:
Add hooks to the parser to jump to profiling code.
If profiling is not present, then return an error message upon being
used.
---
Manual merge, undoing first patch.
---
Fix merge problems.
---
Include patch backported to 5.0-global.
THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
From prepared statement execution, set the query source in the
profiler, as we can't get it from thd .
---
Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_select.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/sql_show.cc:
Abstract setting thread-info into a function or macro.
Also, remove "static" qualification on schema_table_store_record()
so that external functions may use it.
---
Manual merge, undoing first patch.
sql/sql_table.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_update.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_view.cc:
Abstract setting thread-info into a function or macro.
---
Manual merge, undoing first patch.
sql/sql_yacc.yy:
Add new lexer symbols and insert new grammatical rules necessary to
retreive profiling information.
---
Manual merge, undoing first patch.
---
Fix merge problems.
sql/table.h:
Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
New BitKeeper file ``mysql-test/r/profiling.result''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
mysql-test/t/profiling.test:
New BitKeeper file ``mysql-test/t/profiling.test''
---
Include more verbose that describes the queries so far.
Include Giuseppe's tests.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
sql/sql_profile.cc:
New BitKeeper file ``sql/sql_profile.cc''
---
If query_source is NULL, as can sometimes happen, then don't try
to copy that memory.
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.
Limit the size of captured query text.
No longer log queries that are zero length.
sql/sql_profile.h:
New BitKeeper file ``sql/sql_profile.h''
---
Make each new session use its own numbering of query_ids, and not
show the global-pool numbers to the user.
Provide a way for prepared statements to set the query_source.
---
Make it less expensive to limit the size of the queries.
2007-02-22 16:03:08 +01:00
|
|
|
#endif /* ENABLED_PROFILING */
|