← Back to team overview

maria-developers team mailing list archive

Re: ceae9ba: MDEV-7999 - PROFILING routines take 0.2% when profiling disabled

 

Hi Sergei,

On Sat, May 09, 2015 at 10:04:31AM +0200, Sergei Golubchik wrote:
> Hi, Sergey!
> 
> On Apr 15, svoj@xxxxxxxxxxx wrote:
> > revision-id: ceae9ba7c8872d6558b331ef1ed1ebef42ecdc19
> > parent(s): 367f043248112394bd1dc05c72d2844d217a4d55
> > committer: Sergey Vojtovich
> > branch nick: mariadb
> > timestamp: 2015-04-15 18:12:23 +0400
> > message:
> > 
> > MDEV-7999 - PROFILING routines take 0.2% when profiling disabled
> 
> Ok to push.
> One question:
> 
> > diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
> > index 2eaaea4..9fa4d64 100644
> > --- a/sql/sql_profile.cc
> > +++ b/sql/sql_profile.cc
> > @@ -720,4 +665,10 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond
> >    DBUG_RETURN(0);
> >  }
> > +
> > +
> > +void PROFILING::reset()
> > +{
> > +  enabled= thd->variables.option_bits & OPTION_PROFILING;
> > +}
> 
> Why is this not inlined?
Two reasons:
1. sql_profile.h can't include sql_class.h to see fair THD declaration because
   PROFILING must be declared before THD.
2. it is called once on connect and whenever "profiling" varaible is updated,
   which is not hot path.

Thanks,
Sergey


References