Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build results of e9f2446 (on master)
- Loading branch information
Showing
9 changed files
with
215 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
Revision history for Catalyst::Plugin::MemoryUsage | ||
|
||
0.1.1 2010-12-09 23:34:59 America/Montreal | ||
* Add support for NetBSD. | ||
0.2.0 2011-06-09 | ||
[ENHANCEMENTS] | ||
- Report now use Text::SimpleTable | ||
|
||
0.1.0 2010-12-09 21:25:39 America/Montreal | ||
* If the OS is not Linux, issue a warning and don't active the plugin. | ||
0.1.1 2010-12-09T23:34:59Z | ||
- Add support for NetBSD. | ||
|
||
0.0.2 2010-11-29 20:41:21 America/Montreal | ||
* Flesh out the documentation a little bit. | ||
* Add a test. | ||
0.1.0 2010-12-09T21:25:39Z | ||
- If the OS is not Linux, issue a warning and don't active the plugin. | ||
|
||
0.0.1 2010-11-28 23:05:10 America/Montreal | ||
* First release on an unsuspecting world. | ||
0.0.2 2010-11-29T20:41:21Z | ||
- Flesh out the documentation a little bit. | ||
- Add a test. | ||
|
||
0.0.1 2010-11-28T23:05:10Z | ||
- First release on an unsuspecting world. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# NAME | ||
|
||
Catalyst::Plugin::MemoryUsage - Profile memory usage of requests | ||
|
||
# VERSION | ||
|
||
version 0.2.0 | ||
|
||
# SYNOPSIS | ||
|
||
In YourApp.pm: | ||
|
||
package YourApp; | ||
|
||
use Catalyst qw/ | ||
MemoryUsage | ||
/; | ||
|
||
In a Controller class: | ||
|
||
sub foo :Path( '/foo' ) { | ||
# ... | ||
|
||
something_big_and_scary(); | ||
|
||
$c->memory_usage->record( 'finished running iffy code' ); | ||
|
||
# ... | ||
} | ||
|
||
# DESCRIPTION | ||
|
||
`Catalyst::Plugin::MemoryUsage` adds a memory usage profile to your debugging | ||
log, which looks like this: | ||
|
||
[debug] memory usage of request | ||
.--------------------------------------------------+------+------+------+------+------+------+------+------+------+------. | ||
| | vsz | del- | rss | del- | sha- | del- | code | del- | data | del- | | ||
| | | ta | | ta | red | ta | | ta | | ta | | ||
+--------------------------------------------------+------+------+------+------+------+------+------+------+------+------+ | ||
| preparing for the request | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
| after TestApp::Controller::Root : root/_BEGIN | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
| after TestApp::Controller::Root : root/_AUTO | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
| in the middle of index | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
| after TestApp::Controller::Root : root/index | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
| after TestApp::Controller::Root : root/_ACTION | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
| after TestApp::Controller::Root : root/_END | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
| after TestApp::Controller::Root : root/_DISPATCH | 28M | | 22M | | 2.2M | | 1.1M | | 20M | | | ||
'--------------------------------------------------+------+------+------+------+------+------+------+------+------+------' | ||
|
||
# METHODS | ||
|
||
## `memory_usage()` | ||
|
||
Returns the [Memory::Usage](http://search.cpan.org/perldoc?Memory::Usage) object available to the context. | ||
|
||
To record more measure points for the memory profiling, use the `record()` | ||
method of that object: | ||
|
||
sub foo :Path { | ||
my ( $self, $c) = @_; | ||
|
||
... | ||
|
||
big_stuff(); | ||
|
||
$c->memory_usage->record( "done with big_stuff()" ); | ||
|
||
... | ||
} | ||
|
||
## `reset_memory_usage()` | ||
|
||
Discards the current `Memory::Usage` object, along with its recorded data, | ||
and replaces it by a shiny new one. | ||
|
||
# BUGS AND LIMITATIONS | ||
|
||
`Memory::Usage`, which is the module `Catalyst::Plugin::MemoryUsage` relies | ||
on to get its statistics, only work for Linux-based platforms. Consequently, | ||
for the time being `Catalyst::Plugin::MemoryUsage` only work on Linux and | ||
NetBSD. This being said, patches are most welcome. :-) | ||
|
||
# SEE ALSO | ||
|
||
[Memory::Usage](http://search.cpan.org/perldoc?Memory::Usage) | ||
|
||
# AUTHOR | ||
|
||
Yanick Champoux <yanick@babyl.dyndns.org> | ||
|
||
# COPYRIGHT AND LICENSE | ||
|
||
This software is copyright (c) 2010 by Yanick Champoux. | ||
|
||
This is free software; you can redistribute it and/or modify it under | ||
the same terms as the Perl 5 programming language system itself. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.