malenki / tictactic
1.2.0
2013-12-07 18:16 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-11-04 10:36:06 UTC
README
A simple timer for multiple things at once…
Quick example of use:
$t = \Malenki\TicTacTic::getInstance(); $t->start('foo'); sleep(4); $t->finish('foo'); echo "\n"; echo $t->get('foo'); echo "\n";
Full example (avaible into source files too):
include('src/Malenki/TicTacTic.php'); $t = \Malenki\TicTacTic::getInstance(); $t->start('foo'); echo "\n"; echo $t->done('foo') ? 'FOO done' : 'FOO is running'; echo "\n"; sleep(3); $t->finish('foo'); //$t->finish('thing'); // if uncommented, should throw exception echo "\n"; echo $t->done('foo') ? 'FOO done' : 'FOO is running'; echo "\n"; $t->start('bar'); sleep(2); $t->finish('bar'); $t->start('something'); sleep(1); $t->finish('something'); echo "\n"; printf('%d timers:', count($t)); echo "\n"; echo $t->get('foo'); echo "\n"; echo $t->get('bar'); echo "\n"; echo $t->get('something'); echo "\n"; printf('Averages:', count($t)); echo "\n"; echo $t->average(); echo "\n"; echo $t->average(array('foo', 'something')); // for two of them only echo "\n"; echo "\n";
And voilà! Do you need a full doc for that? ;-)