From: Peter Rabbitson Date: Wed, 12 May 2010 11:48:40 +0000 (+0000) Subject: Better stats API explanation (SpiceMan) X-Git-Tag: 5.80025~2^2~13^2~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=01c5eab062ebbebf3ad21decd56e00fa105570a7 Better stats API explanation (SpiceMan) --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 976e241..fdb391f 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -281,14 +281,15 @@ Specifies a comma-delimited list of log levels. =head2 -Stats -Enables statistics collection and reporting. You can also force this setting -from the system environment with CATALYST_STATS or _STATS. The -environment settings override the application, with _STATS having the -highest priority. +Enables statistics collection and reporting. -e.g. + use Catalyst qw/-Stats=1/; - use Catalyst qw/-Stats=1/ +You can also force this setting from the system environment with CATALYST_STATS +or _STATS. The environment settings override the application, with +_STATS having the highest priority. + +Stats are also enabled if L<< debugging |/"-Debug" >> is enabled. =head1 METHODS @@ -2830,15 +2831,24 @@ the plugin name does not begin with C. Returns an arrayref of the internal execution stack (actions that are currently executing). +=head2 $c->stats + +Returns the current timing statistics object. By default Catalyst uses +L, but can be set otherwise with +L<< stats_class|/"$c->stats_class" >>. + +Even if L<< -Stats|/"-Stats" >> is not enabled, the stats object is still +available. By enabling it with C< $c->stats->enabled(1) >, it can be used to +profile explicitly, although MyApp.pm still won't profile nor output anything +by itself. + =head2 $c->stats_class -Returns or sets the stats (timing statistics) class. +Returns or sets the stats (timing statistics) class. L is used by default. =head2 $c->use_stats -Returns 1 when stats collection is enabled. Stats collection is enabled -when the -Stats options is set, debug is on or when the _STATS -environment variable is set. +Returns 1 when L<< stats collection|/"-Stats" >> is enabled. Note that this is a static method, not an accessor and should be overridden by declaring C in your MyApp.pm, not by calling C<< $c->use_stats(1) >>.