Re: Using DBI::Profile to count and time database calls

Bill Moseley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <CAKhN_m5hjmpyGBWG65SFoc5itTt+JTueba4Ff8oSMBwk2Y6cpg@mail.gmail.com>
Noting like writing an email to trigger reading the docs again.

On Tue, Oct 7, 2014 at 11:43 AM, Bill Moseley <[email protected]> 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;} ] );




>
> 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
> [email protected]
>



-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.