Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-03-28 21:21:34-04:00, cmiller@stripped +2 -0
Bug#27501: 5.0 significantly more sys ("kernel") time than 4.1 \
due to getrusage() calls
Even if profiling is turned off, the parser makes calls to reset
the state at the beginning of each query. That would eventually
instantiate a PROFILE_ENTRY, which does indeed capture resource
usage.
Instead, now check that profiling is active before progressing
far into the storage/expiration of old entries in the history.
This has the pleasant side-effect that queries to toggle profiling
are not recorded in the history.
mysql-test/r/profiling.result@stripped, 2007-03-28 21:21:33-04:00, cmiller@stripped +1 -1
Now after we turn off profiling, the beginning of the next query
refuses to enter the profiling code and it discards the info.
sql/sql_profile.cc@stripped, 2007-03-28 21:21:33-04:00, cmiller@stripped +11 -0
Add the same condition twice: Once to abort storing previous
query information and the other to abort initialization for this
query that is starting.
We do this symmetrically, before and after expiring old history
entries, so that the counts are correct.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: cmiller
# Host: zippy.cornsilk.net
# Root: /home/cmiller/work/mysql/mysql-5.0-comeng
--- 1.3/mysql-test/r/profiling.result 2007-03-27 10:31:28 -04:00
+++ 1.4/mysql-test/r/profiling.result 2007-03-28 21:21:33 -04:00
@@ -248,6 +248,7 @@
12
show profiles;
Query_ID Duration Query
+15 # select count(*) from t1
16 # insert into t1 select * from t1
17 # insert into t1 select * from t1
18 # insert into t1 select * from t1
@@ -277,7 +278,6 @@
42 # insert into t1 values (1), (2), (3)
43 # insert into t1 values (1), (2), (3)
44 # select * from t1
-45 # set session profiling = OFF
set session profiling = ON;
select @@profiling;
@@profiling
--- 1.6/sql/sql_profile.cc 2007-03-28 10:04:41 -04:00
+++ 1.7/sql/sql_profile.cc 2007-03-28 21:21:33 -04:00
@@ -493,6 +493,9 @@
while (history.elements > thd->variables.profiling_history_size)
delete history.pop();
+ if (likely(((thd)->options & OPTION_PROFILING) == 0))
+ DBUG_VOID_RETURN;
+
if (current != NULL)
{
if (keeping &&
@@ -519,11 +522,19 @@
DBUG_VOID_RETURN;
}
+/**
+ Store and clean up the old information and get ready to hold info about this
+ new query. This is called very often so it must be very lightweight if
+ profiling is not active.
+*/
void PROFILING::reset()
{
DBUG_ENTER("PROFILING::reset");
store();
+
+ if (likely(((thd)->options & OPTION_PROFILING) == 0))
+ DBUG_VOID_RETURN;
if (current != NULL)
current->reset();
| Thread |
|---|
| • bk commit into 5.0 tree (cmiller:1.2423) BUG#27501 | Chad MILLER | 29 Mar |