On Mon, Sep 30, 2002 at 06:27:38PM -0400, Sam Tregar wrote:
> Hello all.  I'm thinking about creating a DBI::Profile subclass to enable
> profiling of database queries in large Apache/mod_perl applications.

Excellent. I was hoping someone would.

> Here's my plan:
> 
>   - At runtime, instead of displaying output, dump the collected
>     profiling data into a data file.  This would be the equivalent
>     of the tmon.out file produced by Devel::DProf and Devel::Profiler.
> 
>   - Write a separate program to slice and dice the collected
>     data after a run is complete.  This would be equivalent to dprofpp
>     from Devel::DProf.

Please put the save/load/slice-n-dice logic into a module so it can be reused.
Perhaps DBI::ProfileData

>   - Create an add-on class to interface this sub-class with
>     Apache/mod_perl enabling each Apache process to produce a separate
>     DBI::Profile dump. These can then be viewed independently using the
>     dprofpp work-alike. This would be equivalent to the functionality of
>     Apache::DProf and Devel::Profile::Apache.
> 
> Additional ideas, not required by my needs but possibly desirable:
> 
>   - Build the sub-class in such a way that it does not accumulate
>     profiling data in-memory without limit.  Devel::DProf and
>     Devel::Profiler accomplish this by doing buffered writes of raw deltas
>     into the data file and only assembling the full picture after the
>     fact.  A quick think on the interface offered by DBI::Profile
>     suggests that this would be impossible without rewriting DBI::Profile.

I don't see a problem. I think there's sufficient information stored
in each node to allow nodes to be merged later.

>   - Allow multiple data files produced by the Apache module to be merged
>     into one.  This is something I wanted to do with Devel::Profiler but
>     it seems more possible in this context.
> 
> Given the above, help me answer these questions:
> 
>   - Is it possible?

Yes. (For some values of "it" and "possible" :)

>   - What possible problems do you think I will encounter?

Not enough to worry about.

>   - What should I name it?  Ideas: DBIx::DProf, DBIx::Profiler...

If we can agree on the design (set of modules and interfaces) I'd
happily include it in the DBI distribution - if that's okay with you.

Tim.

Reply via email to