library timer
A Simple Timer mark script
ans/timer
A Simple Timer mark script
- Wednesday, August 22, 2012
- by eusonlito
- Repository
- 1 Watchers
- 1 Stars
- 6 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
Timer
This script works as simple timer control to your app, (*1)
Usage
<?php
include (__DIR__.'/libs/ANS/Timer/Timer.php');
$Timer = new \ANS\Timer\Timer;
$Timer->mark('Starting a mark previous to operations');
foreach ($alotofoperations as $operation) {
$Timer->mark('Start operation '.$operation->name);
$operation->function();
$Timer->mark('End operation '.$operation->name);
}
$Timer->mark('Ended a mark previous to operations');
foreach ($Timer->get() as $timer) {
echo "\n".sprintf('%01.6f', $timer['total']).' - '.$timer['text'];
}
echo "\n".$Timer->getMemoryUsage();