summaryrefslogtreecommitdiff
path: root/buildscripts/Benchmark/doc/timer_example.php
diff options
context:
space:
mode:
authorxue <>2006-06-19 02:31:27 +0000
committerxue <>2006-06-19 02:31:27 +0000
commitb59ab2490b1bb82dc1d0b58d89584182b405d0a0 (patch)
treed6770beffd006c092b3211208b686462cd279ab0 /buildscripts/Benchmark/doc/timer_example.php
parent9b918c5b7fa3aac6e077f15dc06c1d8d7185f5aa (diff)
build script update. Fixed #82 and #165.
Diffstat (limited to 'buildscripts/Benchmark/doc/timer_example.php')
-rw-r--r--buildscripts/Benchmark/doc/timer_example.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/buildscripts/Benchmark/doc/timer_example.php b/buildscripts/Benchmark/doc/timer_example.php
new file mode 100644
index 00000000..93dd05c6
--- /dev/null
+++ b/buildscripts/Benchmark/doc/timer_example.php
@@ -0,0 +1,18 @@
+<?php
+require '../Timer.php';
+
+function wait($amount) {
+ for ($i=0; $i < $amount; $i++) {
+ for ($i=0; $i < 100; $i++);
+ }
+}
+// Pass the param "true" to constructor to automatically display the results
+$timer = new Benchmark_Timer();
+$timer->start();
+wait(10);
+$timer->setMarker('Mark1');
+echo "Elapsed time between Start and Mark1: " .
+ $timer->timeElapsed('Start', 'Mark1') . "\n";
+wait(50);
+$timer->stop();
+$timer->display();