Sorry for the delay. On Tue, Oct 07, 2014 at 12:00:31PM -0700, Bill Moseley wrote: > Noting like writing an email to trigger reading the docs again.
:) > On Tue, Oct 7, 2014 at 11:43 AM, Bill Moseley <[1]mose...@hank.org> wrote: > > I'm trying to just count number of database queries and the time spent > waiting on the database. > > Does this look correct? > my $h = DBI::Profile->new( Path => [ sub { return $_[1] =~ > /^(?:execute|do|select)/ ? undef : \undef;} ] > ); Yes, though evaluating the regex during data collection will be slow. If efficiency is a concern then it's better to collect using '!MethodName' and post-process to merge the stats for the methods you're interested in. Tim. > > I can use this to just gather grand totals: > DBI::Profile->new( Path => [ ] ); > The total time is fine even if it includes the small amount of time in > DBI instead of directly waiting > on the database. But, the counts are do not represent just trips to the > database, rather apparently > counts of all methods called (e.g. a prepare and execute counts as 2). > Using: > DBI::Profile->new( Path => [ '!MethodName' ] ); > might be ok, but I'd have to then find all the methods that go to the db > (e.g. "execute", "do"). > Can I use DBI::Profile to just gather up counts to the database? > Thanks, > -- > Bill Moseley > [2]mose...@hank.org > > -- > Bill Moseley > [3]mose...@hank.org > > References > > Visible links > 1. mailto:mose...@hank.org > 2. mailto:mose...@hank.org > 3. mailto:mose...@hank.org