NAME

Catalyst::Plugin::tv_interval - call tv_interval of Time::HiRes to ease profiling.

SYNOPSIS

use Catalyst qw/-Debug tv_interval/;

# in controller later
sub somesub : Local {
    my ($self, $c) = @_;
    
    $c->tv_mark_point;
    # CODE { do something }
    $c->tv_mark_point; # print debug log how long this CODE takes
    
    $c->clear_marked_point; # now it looks like we never call ->tv_mark_point before
    $c->tv_mark_point;
    # CODE { do something else }
    $c->tv_mark_point;
}

DESCRIPTION

This module uses the functions of tv_interval and [gettimeofday] in Time::HiRes. and print debug log like as follows:

[debug] tv_interval: MyApp::Controller::Test from line 12 to 16 takes 0.013818
[debug] tv_interval: MyApp::Controller::Test from line 16 to 22 takes 1.000408

INTERFACE

tv_mark_point

if this is no 'ponit' before, mark a point and remember the file name, line and the [gettimeofday]. or else, compare the 'point' now with the old 'point' and print debug log.

clear_marked_point

clear the old 'point'

DEPENDENCIES & SEE ALSO

Catalyst - The Elegant MVC Web Application Framework
Time::HiRes - High resolution alarm, sleep, gettimeofday, interval timers

AUTHOR

Fayland, <fayland at gmail.com>

COPYRIGHT & LICENSE

Copyright 2007 Fayland and Zorpia Ltd. Company http://www.zorpia.com all rights reserved.

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