Commit graph

25 commits

Author SHA1 Message Date
Ignacio Galarza
2d9421c3bb Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-13 11:41:47 -05:00
Georgi Kodinov
b180a10233 Fixed a warning in sql_profile.cc 2009-01-12 18:17:15 +02:00
kostja@dipika.(none)
f8ec5e0984 Fix a compilation failure of the community tree. 2008-02-19 23:47:15 +03:00
cmiller@zippy.cornsilk.net
d27fb9f939 Insert profiling instructions into s-p code to make each statement
be profiled separately.

Expand the time formats in i_s.profiling to wide enough for larger
numbers.
2007-11-13 09:46:17 -05:00
cmiller@zippy.cornsilk.net
5626ec5733 Don't start profiling too soon. Begin timing when the packet is
read.

Do not store profiling information when there is no query text.  We
don't wish to capture non-COM_QUERY packets.
2007-11-09 20:29:02 -05:00
cmiller@zippy.cornsilk.net
f12087af58 Rewrite profiler code to be easier to maintain and less buggy.
Between 5.0 and 5.1, the step of incrementing the global query id
changed, which broke how the profiler noticed when a new query had
started.  That reset the state list and caused all but the last 
five (or so) states to be thrown away.

Now, don't watch for query_id changes in the lower level.

Add a bogus state change at the end of profiling so that the last 
real state change is timed.

Emit source reference for the start of the span of time instead of
the end of it.
2007-11-09 14:45:44 -05:00
cmiller@zippy.cornsilk.net
0455e69b2b Fix several merge problems. There are many changes in 5.1 from 5.0
that affect profiling.
2007-11-02 11:41:58 -04:00
cmiller@zippy.cornsilk.net
e82bbb81d0 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1
2007-10-31 17:24:32 -04:00
cmiller@zippy.cornsilk.net
872d65a547 Sundry changes to fix merge problems. Most of these are duplicated
in 5.0-community, but pulling to merge was very hard.
2007-10-31 16:39:59 -04:00
cmiller@zippy.cornsilk.net
8d836dd38a Push history-limiting code until after the code that adds new
history entries.  Lazy deletion isn't smart or useful here.
2007-10-31 12:29:32 -04:00
cmiller@zippy.cornsilk.net
71d5c5350a Track typedef'd struct. Name changed in Enterprise tree, but
community-exclusive file also referred to struct.
2007-10-04 10:35:09 -04:00
cmiller@zippy.cornsilk.net
da78d3b7a3 In 5.0, Field_double::val_str uses "%g" to render floating point
numbers, which uses "X.YeZ" notation when the exponent Z would be
less than -4. That behavior at -4 is not exactly what we want, and
our Decimal type offers smarter number representation.  By changing
profiling to use Decimal types, we get more readable output.
2007-07-03 12:20:19 -04:00
cmiller@zippy.cornsilk.net
01f572052d Unify profiling SHOW code and INFORMATION_SCHEMA code for
profiling.  Also,

Bug#26938: profiling client hang if used before enabled

In the SHOW command, not sending header data because we had no 
rows to send was a protocol violation.  Porting the SHOW PROFILE
command to use the Information Schema table avoids that problem.
2007-07-02 07:27:39 -04:00
cmiller@zippy.cornsilk.net
587290cf00 Fix up merge. Some macros are now functions. Some functions are
renamed.  Some new THD proc_info states are new.  Directories must be
encountered in make in a specific order, to have symlinks already set.
Move community-server-specific tests into own tests, so that we can 
exempt them from testing on enterprise servers.
2007-05-02 14:13:33 -04:00
cmiller@zippy.cornsilk.net
93e804a616 Wrap code specific to the comunity-server in additional CPP #ifdef .
Add a new autoconf paremeter --{en,dis}able-community-features .  The
default is disable for enterprise servers.

Though this is a 5.0 tree, it is only to be merged into the 5.0-community
tree and the global 5.1 tree, never to the 5.0-enterprise tree.
2007-04-24 18:11:55 -04:00
cmiller@zippy.cornsilk.net
88455a047f Changing the state of whether we're recording profiling information
halfway through a query (as happens in "SET SESSION PROFILING = ...")
has a few side-effects, the worst of which is a memory leak for
prepared statements, which poke directly from the parser into the 
profiling code (we don't have the query text when we need it) and 
that overwrites a pointer to heap-allocated memory when the previous
statement turns on profiling.

Instead, now set a flag when we begin a new statement that tracks 
whether profiling is on _at the start_ of the query.  Use that to
track whether we gather info.

Additionally, use that AND use the state of the profiling variable
after the end of a query to know whether to store information about 
the query that just finished.
2007-04-06 09:15:18 -04:00
cmiller@zippy.cornsilk.net
4078a7ccce Unreported minor bug: We start numbering query IDs at zero, which
is a special case in "SHOW PROFILE FOR QUERY n".  No one can get
the zero item (which is always the statement that turns on profiling),
because zero represents the final item, internally.

Now, order the queries starting at one.
2007-04-03 19:52:24 -04:00
cmiller@zippy.cornsilk.net
cd28612e4b Backport:
B-g#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.
2007-04-03 19:50:55 -04:00
cmiller@zippy.cornsilk.net
ad181bb037 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.
2007-04-03 19:45:28 -04:00
cmiller@zippy.cornsilk.net
9816842b58 Backport:
B-g#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".
2007-04-03 17:59:52 -04:00
cmiller@zippy.cornsilk.net
94036e0137 Patch to release clone. Fixes two post-pushbuild discovered failures.
Expand float size to avoid assert()ion failures.

"_db_func_" isn't a known linked object on some platforms, possibly 
because it is occasionaly shadowed by DBUG variables.  Avoid that
confusion.
2007-03-02 09:14:33 -05:00
cmiller@calliope.local.cmiller/calliope.local
c186793b6c Some changes suggested Serg, from message <20070223210659.GA24202@janus.mylan> 2007-02-26 13:11:36 -05:00
cmiller@zippy.cornsilk.net
b30fd9b414 Disambiguate method call. (Windows compiler error.) 2007-02-22 16:25:47 -05:00
cmiller@zippy.cornsilk.net
6e096ee8d9 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.
2007-02-22 10:03:08 -05:00
cmiller@zippy.cornsilk.net
10cdf90bd3 Bug#24795: Add SHOW PROFILE
Patch contributed by Jeremy Cole.  CLA received Oct 2006 by Kaj Arnö

Add rudimentary query profiling support.
2007-01-03 17:15:10 -05:00