note 45292 deleted from function.microtime by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 01 Sep 2004 17:27:33 +0000 |
| Subject: | note 45292 deleted from function.microtime by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75856@lists.php.net to get a copy of this message | ||
Note Submitter: mirage aht rateaprof dawt cawm
----
Sorry guys, one time just isn't enough for me:
pseudo-code usage example:
splittime ("total");
splittime ("one");
do this
splittime ("one");
splittime ("two");
do that
splittime ("two");
splittime ("total");
The goods:
Function splittime ($set) {
static $timers = array();
$now = microtime(true);
if (isset($timers["$set"])) {
$diff = $now - $timers["$set"];
echo ">>Split $set $diff<<\n";
} else {
echo ">>Start $set $now<<\n";
}
$timers["$set"] = $now;
}
Someone else can make the output nicer while I get some sleep tonight.