The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

DiaColloDB::Timer - diachronic collocation db, timer

SYNOPSIS

##========================================================================
## PRELIMINARIES

use DiaColloDB::Timer;

##========================================================================
## Constructors etc.

$timer = $CLASS_OR_OBJECT->new(%args);

##========================================================================
## Timing

$timer = $CLASS_OR_OBJECT->start();
$timer = $timer->stop();
$timer = $timer->reset();
$elapsed = $timer->elapsed();
$hms     = $timer->hms($sfmt?);
$timestr = $timer->timestr($sfmt?);

DESCRIPTION

DiaColloDB::Timer provides a simple object-oriented high resolution timer used e.g. for measuring query processing time in the command-line utilities.

Constructors etc.

new
$timer = CLASS_OR_OBJECT->new(%args);

%args, object structure:

started => $t0,      ##-- time last operation started
elapsed => $elapsed, ##-- elapsed time (after stop())

Timing

start
$timer = CLASS_OR_OBJECT->start();

(re-)starts timer

stop
$timer = $timer->stop();

stops timer and adds current interval to {elapsed}

reset
$timer = $timer->reset();

stops and re-sets timer

elapsed
$elapsed = $timer->elapsed();

get total elapsed time for this timer

hms
$hms = $timer->hms($sfmt?);
($h,$m,$s) = $timer->hms($sfmt?);

parses and optionally formats elapsed time as HH:MM:SS.SSS

timestr
$timestr = $timer->timestr($sfmt?);

parses and formats elapsed time as Hh?Mm?Ss

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2015-2016 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

DiaColloDB(3pm), perl(1), ...