Bug #24795 | SHOW PROFILE contribution by Jeremy Cole | ||
---|---|---|---|
Submitted: | 4 Dec 2006 11:54 | Modified: | 6 Jul 2007 3:22 |
Reporter: | Kaj Arnö | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Logging | Severity: | S4 (Feature request) |
Version: | 5.0-community | OS: | Any |
Assigned to: | Chad MILLER | CPU Architecture: | Any |
Tags: | Contribution |
[4 Dec 2006 11:54]
Kaj Arnö
[5 Dec 2006 14:42]
Lenz Grimmer
Patch should be available from http://jcole.us/patches/mysql/
[2 Jan 2007 21:59]
Chad MILLER
Applying to 5.0 Community tree. Patch needs some clean-up before it's ready. It didn't apply cleanly to my tree, for instance.
[4 Jan 2007 3:27]
Chad MILLER
http://lists.mysql.com/commits/17597
[11 Jan 2007 15:46]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/17955 ChangeSet@1.2327, 2007-01-11 10:46:07-05:00, cmiller@zippy.cornsilk.net +14 -0 Reverting most of patch! Bug#24795: Add SHOW PROFILE This code is not complete. I'm removing the guts, and leaving only the macro that sets the THD proc_info patch. That part will be useful scaffolding for adding profiling (and other things) later. Jeremy Cole will continue to work on SHOW PROFILE and submit a patch later that is complete.
[11 Jan 2007 16:16]
Sergei Golubchik
A portable alternative to __FUNCTION__ is (enhanced version from gcc manual): #if __STDC_VERSION__ < 199901L # if __GNUC__ >= 2 # define __func__ __FUNCTION__ # else # define __func__ _db_func_ extern const char *_db_func_; # endif #endif and somewhere: extern const char *_db_func_="<unknown>"; which assumes you will use __func__ in your patch instead of __FUNCTION__.
[11 Jan 2007 16:22]
Andrey Hristov
There is a way to get __FUNCTION__ also out of Microsoft's Compiler, the Sun's compiler, probably few others. I needed it for the Event scheduler, and had a fight for some time, then I resolved to being compatible only with gcc.
[11 Jan 2007 16:30]
Andrey Hristov
VC8, MSDN : __FUNCTION__ Valid only within a function and returns the undecorated name of the enclosing function (as a string). __FUNCTION__ is not expanded if you use the /EP or /P compiler option.
[31 Jan 2007 15:14]
Chad MILLER
Not strictly related to this bug, but necessary to have as this bug-patch relies on it. http://lists.mysql.com/commits/19088
[2 Feb 2007 20:22]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/19278 ChangeSet@1.2359, 2007-02-02 15:21:05-05:00, cmiller@zippy.cornsilk.net +37 -0 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.
[20 Feb 2007 2:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20156 ChangeSet@1.2359, 2007-02-19 21:56:48-05:00, cmiller@zippy.cornsilk.net +38 -0 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.
[22 Feb 2007 15:03]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20375 ChangeSet@1.2383, 2007-02-22 10:03:08-05:00, cmiller@zippy.cornsilk.net +51 -0 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.
[22 Feb 2007 19:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20406 ChangeSet@1.2383, 2007-02-22 14:35:41-05:00, cmiller@zippy.cornsilk.net +53 -0 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. --- Enclose profiling in preprocessor conditions. --- Add profiling source file to cmake file. --- Use correct filename for profiling code. --- Use a cast to disambuguate which PROTOCOL::store() to use.
[12 Mar 2007 0:33]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/21694 ChangeSet@1.2424, 2007-03-11 20:36:38-04:00, cmiller@zippy.cornsilk.net +2 -0 Bug#24795: SHOW PROFILE implementation Don't use memory roots to store profiling information, because memory roots make freeing the data a no-op, and thus long-running processes with profiling turned on the whole time could eventually use all available memory. Instead, use regular heap allocation and deallocation calls to manage profiling data. Replace the leaky List usage with a similar- behaving structure named "Queue".
[5 Jul 2007 15:33]
Chad MILLER
Final step completed, and SHOW and I_S unified. In 5.0.45, community only.
[6 Jul 2007 3:22]
Paul DuBois
Noted in 5.0.45 changelog. Potential memory leaks in the SHOW PROFILE implementation were eliminated.
[28 Jan 2008 6:40]
Bugs System
Pushed into 6.0.5-alpha
[28 Jan 2008 6:51]
Bugs System
Pushed into 5.1.24-rc
[6 Mar 2008 5:33]
Jon Stephens
Bugfix also documented for 5.1.23-ndb-6.2.14, 5.1.24, and 6.0.5.
[30 Mar 2008 0:14]
Jon Stephens
Also noted in the 5.1.23-ndb-6.3.11 changelog.
[6 May 2009 20:22]
Bugs System
Pushed into 5.0.82 (revid:chad@mysql.com-20090506130632-s1cl4ygdj9rt2rrz) (version source revid:chad@mysql.com-20090506130632-s1cl4ygdj9rt2rrz) (merge vers: 5.0.82) (pib:6)