Permalink
Browse files

Build results of 7c28a92 (on master)

  • Loading branch information...
2 parents ea4b166 + 7c28a92 commit 9ee86ee65b107f80e54741fa5270a5cf23e734e1 @yanick committed Jun 19, 2011
Showing with 127 additions and 27 deletions.
  1. +1 −1 Build.PL
  2. +4 −0 Changes
  3. +2 −2 META.json
  4. +2 −2 META.yml
  5. +21 −1 README
  6. +26 −1 README.mkdn
  7. +11 −11 SIGNATURE
  8. +53 −9 lib/Catalyst/Plugin/MemoryUsage.pm
  9. +7 −0 t/lib/TestApp.pm
View
@@ -25,7 +25,7 @@ my %module_build_args = (
'Yanick Champoux <yanick@babyl.dyndns.org>'
],
'dist_name' => 'Catalyst-Plugin-MemoryUsage',
- 'dist_version' => '0.2.0',
+ 'dist_version' => '0.3.0',
'license' => 'perl',
'module_name' => 'Catalyst::Plugin::MemoryUsage',
'recommends' => {},
View
@@ -1,5 +1,9 @@
Revision history for Catalyst::Plugin::MemoryUsage
+0.3.0 2011-06-19
+ [ENHANCEMENTS]
+ - Add config options (report, action_milestones)
+
0.2.0 2011-06-09
[ENHANCEMENTS]
- Report now use Text::SimpleTable
View
@@ -52,7 +52,7 @@
"provides" : {
"Catalyst::Plugin::MemoryUsage" : {
"file" : "lib/Catalyst/Plugin/MemoryUsage.pm",
- "version" : "v0.2.0"
+ "version" : "v0.3.0"
}
},
"release_status" : "stable",
@@ -68,7 +68,7 @@
"web" : "http://github.com/yanick/Catalyst-Plugin-MemoryUsage/tree"
}
},
- "version" : "0.2.0",
+ "version" : "0.3.0",
"x_authority" : "cpan:yanick"
}
View
@@ -24,7 +24,7 @@ name: Catalyst-Plugin-MemoryUsage
provides:
Catalyst::Plugin::MemoryUsage:
file: lib/Catalyst/Plugin/MemoryUsage.pm
- version: v0.2.0
+ version: v0.3.0
requires:
Devel::CheckOS: 0
List::Util: 0
@@ -38,5 +38,5 @@ resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Plugin-MemoryUsage
homepage: http://search.cpan.org/dist/Catalyst-Plugin-MemoryUsage/
repository: git://github.com/yanick/Catalyst-Plugin-MemoryUsage.git
-version: 0.2.0
+version: 0.3.0
x_authority: cpan:yanick
View
22 README
@@ -2,7 +2,7 @@ NAME
Catalyst::Plugin::MemoryUsage - Profile memory usage of requests
VERSION
- version 0.2.0
+ version 0.3.0
SYNOPSIS
In YourApp.pm:
@@ -25,6 +25,13 @@ SYNOPSIS
# ...
}
+ In yourapp.conf:
+
+ <Plugin::MemoryUsage>
+ report 1
+ action_milestones 1
+ </Plugin::MemoryUsage>
+
DESCRIPTION
"Catalyst::Plugin::MemoryUsage" adds a memory usage profile to your
debugging log, which looks like this:
@@ -44,6 +51,19 @@ DESCRIPTION
| after TestApp::Controller::Root : root/_DISPATCH | 28M | | 22M | | 2.2M | | 1.1M | | 20M | |
'--------------------------------------------------+------+------+------+------+------+------+------+------+------+------'
+CONFIGURATION
+ report
+ If true, the memory usage is reported automatically (at debug level) at
+ the end of the request.
+
+ Defaults to true if we are in debugging mode, false otherwise.
+
+ action_milestones
+ If true, automatically adds milestones for each action, as seen in the
+ DESCRIPTION.
+
+ Defaults to true if we are in debugging mode, false otherwise.
+
METHODS
"memory_usage()"
Returns the Memory::Usage object available to the context.
View
@@ -4,7 +4,7 @@ Catalyst::Plugin::MemoryUsage - Profile memory usage of requests
# VERSION
-version 0.2.0
+version 0.3.0
# SYNOPSIS
@@ -31,6 +31,13 @@ In a Controller class:
# ...
}
+In yourapp.conf:
+
+ <Plugin::MemoryUsage>
+ report 1
+ action_milestones 1
+ </Plugin::MemoryUsage>
+
# DESCRIPTION
`Catalyst::Plugin::MemoryUsage` adds a memory usage profile to your debugging
@@ -51,6 +58,24 @@ log, which looks like this:
| after TestApp::Controller::Root : root/_DISPATCH | 28M | | 22M | | 2.2M | | 1.1M | | 20M | |
'--------------------------------------------------+------+------+------+------+------+------+------+------+------+------'
+# CONFIGURATION
+
+## report
+
+If true, the memory usage is reported automatically (at debug level)
+at the end of the request.
+
+Defaults to true if we are in debugging mode,
+false otherwise.
+
+## action_milestones
+
+If true, automatically adds milestones for each action, as seen in the
+DESCRIPTION.
+
+Defaults to true if we are in debugging mode,
+false otherwise.
+
# METHODS
## `memory_usage()`
View
@@ -14,24 +14,24 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 a2bbd1a9f2d93c2078ab6879b4a9b8e5f8cab9dd Build.PL
-SHA1 399c6cba5f210c5f631c84fd59825a8a112e1d65 Changes
+SHA1 655a15d75923e4f42c79e2176c1006b2b107b145 Build.PL
+SHA1 d5976014f897404e765d053413b6d303f33210b7 Changes
SHA1 3ee0d276167c367325eebe1d5ec9877ade504d93 LICENSE
SHA1 6bf5bd4f8be05556f78c1ba88154e232075df775 MANIFEST
-SHA1 504dc50bf489af87cc9d5f092176c0bed5c175cc META.json
-SHA1 cf89f159d3874bb436676ebcf70babdf39d84c31 META.yml
-SHA1 68f9373ece4f5eb126185e68f2ed78746c19426e README
-SHA1 8d1963528f0804d61fc92bae07436fe703564cce README.mkdn
-SHA1 773f05ee07742f7ab08456c52b51a6c1f1c412ed lib/Catalyst/Plugin/MemoryUsage.pm
+SHA1 e96d9789fb12709b47e38d2d25f4c85cc60a4b88 META.json
+SHA1 1130592ebca9756e1fed04b59cbc145dc14b5429 META.yml
+SHA1 c2495db04a2570ae3168db793ea90b37b032a557 README
+SHA1 0ebf66c17dbebc22de0e8c28863fb9aa5d65180c README.mkdn
+SHA1 9134b403e8ff5ad5f1a18a5e74eb6d7df5c43dde lib/Catalyst/Plugin/MemoryUsage.pm
SHA1 050aa113e828a52db3c86065c0c0ed50198b7ce8 t/000-report-versions.t
SHA1 64e87bcc8fd3516cc6a60cbda61661ae89e96e9a t/basic_app.t
-SHA1 579bfe1fb8b92f492eba9a177695e6cc5a6ba3b7 t/lib/TestApp.pm
+SHA1 639fdd3933275747957426dc5ff37c990da88393 t/lib/TestApp.pm
SHA1 2de5436c98b1ec7e9c43759b94ba0059c027736b t/lib/TestApp/Controller/Root.pm
SHA1 afac7b65200ae7161431bfe87dbce7b6ccdf72cc t/not-supported.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-iEYEARECAAYFAk3xaCsACgkQ34Hwf+GwC4xWFgCglxN0x78hswrYe016bAtvzpaa
-8dcAoO6cbiMbaeS4UR/WcCPjjcTffIi+
-=pmmj
+iEYEARECAAYFAk3+dhoACgkQ34Hwf+GwC4xfIgCg24dnVKu6dmrkIHudWG4cMSFA
+m+YAnib99ni8l5cSmG4L/WdjjbUGE02+
+=Y2K4
-----END PGP SIGNATURE-----
@@ -3,7 +3,7 @@ BEGIN {
$Catalyst::Plugin::MemoryUsage::AUTHORITY = 'cpan:yanick';
}
BEGIN {
- $Catalyst::Plugin::MemoryUsage::VERSION = '0.2.0';
+ $Catalyst::Plugin::MemoryUsage::VERSION = '0.3.0';
}
#ABSTRACT: Profile memory usage of requests
@@ -36,6 +36,25 @@ has memory_usage => (
default => sub { Memory::Usage->new },
);
+our $_memory_usage_report;
+our $_memory_usage_record_actions;
+
+
+after setup_finalize => sub {
+ my $c = shift;
+
+ my %config = %{ $c->config->{'Plugin::MemoryUsage'} || {} };
+
+ $_memory_usage_report =
+ exists $config{report} ? $config{report} : $c->debug;
+
+ $_memory_usage_record_actions =
+ exists $config{action_milestones}
+ ? $config{action_milestones} : $c->debug;
+};
+
+
+
sub reset_memory_usage {
my $self = shift;
@@ -82,10 +101,9 @@ sub memory_usage_report {
unless ( $os_not_supported ) {
after execute => sub {
- my $c = shift;
-
- return if $os_not_supported;
+ return unless $_memory_usage_record_actions;
+ my $c = shift;
$c->memory_usage->record( "after " . join " : ", @_ );
};
@@ -95,15 +113,16 @@ around prepare => sub {
my $c = $self->$orig(@_);
- $c->reset_memory_usage;
- $c->memory_usage->record('preparing for the request');
+ $c->memory_usage->record('preparing for the request')
+ if $_memory_usage_record_actions;
return $c;
};
-before finalize => sub {
- my $c = shift;
+after finalize => sub {
+ return unless $_memory_usage_report;
+ my $c = shift;
$c->log->debug( 'memory usage of request'. "\n". $c->memory_usage_report );
};
@@ -123,7 +142,7 @@ Catalyst::Plugin::MemoryUsage - Profile memory usage of requests
=head1 VERSION
-version 0.2.0
+version 0.3.0
=head1 SYNOPSIS
@@ -147,6 +166,13 @@ In a Controller class:
# ...
}
+In yourapp.conf:
+
+ <Plugin::MemoryUsage>
+ report 1
+ action_milestones 1
+ </Plugin::MemoryUsage>
+
=head1 DESCRIPTION
C<Catalyst::Plugin::MemoryUsage> adds a memory usage profile to your debugging
@@ -167,6 +193,24 @@ log, which looks like this:
| after TestApp::Controller::Root : root/_DISPATCH | 28M | | 22M | | 2.2M | | 1.1M | | 20M | |
'--------------------------------------------------+------+------+------+------+------+------+------+------+------+------'
+=head1 CONFIGURATION
+
+=head2 report
+
+If true, the memory usage is reported automatically (at debug level)
+at the end of the request.
+
+Defaults to true if we are in debugging mode,
+false otherwise.
+
+=head2 action_milestones
+
+If true, automatically adds milestones for each action, as seen in the
+DESCRIPTION.
+
+Defaults to true if we are in debugging mode,
+false otherwise.
+
=head1 METHODS
=head2 C<memory_usage()>
View
@@ -29,6 +29,13 @@ use warnings;
use Catalyst qw/ MemoryUsage /;
+__PACKAGE__->config(
+ 'Plugin::MemoryUsage' => {
+ report => 1,
+ action_milestones => 1,
+ },
+);
+
__PACKAGE__->setup;
sub log {

0 comments on commit 9ee86ee

Please sign in to comment.