Egg::Util::BenchMark - Easy bench mark class for Egg.


Egg-Release documentation  | view source Contained in the Egg-Release distribution.

Index


NAME

Top

Egg::Util::BenchMark - Easy bench mark class for Egg.

SYNOPSIS

Top

  my $bench= Egg::Util::BenchMark->new($e);

  $bench->stock('start');
  $bench->stock('run');
  $bench->stock('end');

  $bench->finish;

  # プロジェクトから使うなら
  $e->bench('start');
  $e->bench('run');
  $e->bench('end');

DESCRIPTION

Top

It is an easy bench mark class used with Debaccmord of Egg.

Egg takes the bench mark at each the following method calls while operating by debug mode.

* _prepare
* _dispatch
* _action_start
* _action_end
* _finalize
* _output
* _finish

And, it totals at the end and the report is output by $e->debug_out.

In addition, $e->bench(LABEL_STRING) comes to be reported about the application to take the bench mark in detail including the result when putting it at every step.

When debug mode becomes invalid, arranged $e->bench need not be especially excluded because it is changed to the method of not doing anything.

This module is set up by Egg::Util::Debug. To use other bench mark classes, it is set to environment variable EGG_BENCH_CLASS.

METHODS

Top

new

Constructor.

my $bench= Egg::Util::BenchMark->new;

stock

The bench mark when called is recorded.

  $bench->stock('start');
  $bench->stock('end');

finish

The data recorded by stock is totaled and the report is returned.

  print STDERR $bench->finish;

SEE ALSO

Egg::Release, Egg::Util::Debug, Time::HiRes,

AUTHOR

Top

Masatoshi Mizuno <lushe&64;cpan.org>

COPYRIGHT AND LICENSE

Top


Egg-Release documentation  | view source Contained in the Egg-Release distribution.