• unknown's avatar
    Backport: · 46503d16
    unknown authored
    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.
    
    
    mysql-test/r/profiling.result:
      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:
      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.
    46503d16
sql_profile.cc 23.8 KB