my $mu = Memory::Usage->new();
# Record amount of memory used by current process
# Do the thing you want to measure
# Record amount in use afterwards
# Spit out a report
DESCRIPTIONThis module lets you attempt to measure, from your operating system's perspective, how much memory a process is using at any given time.
- new ( )
- Creates a new Memory::Usage object. This object will contain usage state as recorded along the way.
- record ( $message [, $pid ])
- Record the memory usage at call time, logging it internally with the provided message. Optionally takes a process ID to record memory usage for, defaulting to the current process.
- report ( )
- Generates report on memory usage.
- dump ( )
- Prints report on memory usage to stderr.
- state ( )
Return arrayref of internal state. Returned arrayref contains zero or more
references to arrays with the following columns (in order). All sizes are in
- timestamp (in seconds since epoch)
- message (as passed to ->record())
- virtual memory size
- resident set size
- shared memory size
- text (aka code or exe) size
- data and stack size
AUTHORDave O'Neill, "<dmo at dmo.ca>"
BUGSPlease report any bugs or feature requests to "bug-memory-usage at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Memory-Usage>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORTYou can find documentation for this module with the perldoc command.
You can also look for information at:
- RT: CPAN's request tracker
- Search CPAN
LICENSE AND COPYRIGHTCopyright 2010 Dave O'Neill.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.