The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Memory::Stats - Memory Usage Consumption of your process

VERSION

version 0.04

DESCRIPTION

This module give you the memory usage (resident RSS), of a part of your process. It use Proc::ProcessTable and should work on all platforms supported by this module.

You can check this link to for explanation: http://blog.celogeek.com/201312/394/perl-universal-way-to-get-memory-usage-of-a-process/

SYNOPSIS

  use Memory::Stats;

  my $stats = Memory::Stats->new;

  $stats->start;
  # do something
  $stats->checkpoint("before my big method");
  # big method
  $stats->checkpoint("after my big method");
  $stats->stop;
  $stats->report;

METHODS

start

Start recording memory usage.

 $mu->start;

checkpoint

Mark a step in the recording.

  $mu->checkpoint('title of the checkpoint');

You need to start first.

stop

Stop the recording.

 $mu->stop;

You need to start first.

delta_usage

Get the current delta memory usage since the last checkpoint

  $mu->delta_usage

usage

Get the total memory usage (difference between stop and start)

 $mu->usage

You need to start and stop first.

report

Dump all the recording.

 $mu->report;

It will display all memory checkpoint, with delta. You can call it at any times.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/celogeek/perl-memory-stats/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

celogeek <me@celogeek.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by celogeek <me@celogeek.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.