[Catalyst-dev] Proposal for built-in profiling function
Matt S Trout
dbix-class at trout.me.uk
Thu Oct 11 22:39:44 GMT 2007
On Thu, Oct 11, 2007 at 10:17:13PM +0930, Jon Schutz wrote:
> That Catalyst reports the amount of time taken in each component method
> is very neat... but restrictive. It would be nice to easily add
> "profile points" into the code and have the execution time to those
> points reported as well.
>
> The idea is that the summary report which currently looks something like
> this:
>
> .----------------------------------------------------------------+-----------.
> | Action | Time |
> +----------------------------------------------------------------+-----------+
> | /status/auto | 0.000751s |
> | /status/syncstatus | 0.241494s |
> | /end | 0.065917s |
> | -> SLx::View::TT->process | 0.064111s |
> '----------------------------------------------------------------+-----------'
>
> with scatterings of code like this:
>
> $c->profile("starting long routine");
> ...
> $c->profile("done stuff");
> ...
Wouldn't it be better to have start_profile + end_profile methods?
There was a Catalyst::Plugin::Timer at one point proposed that did roughly
that.
> So, I'd like to propose a trivial change to the core code to allow this
> functionality. Basically it just adds a 'profile' method which hooks
> into the existing timing tree. I've been running this code and found it
> enormously useful in isolating problem areas. Patch for Catalyst.pm
> against 5.7010 is attached.
Your patch isn't whitespace clean (you have whitespace only changes and
mixed spaces and tabs in there), has no tests and isn't a diff -ur, so I can't
actually tell whether it does anything sensible.
Try again please?
(Oh, and you want Catalyst::Model::DBIC::Schema::QueryLog - avoid the DBIC
profiling plugins, they're all variously broken)
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst-dev
mailing list