Benchmark
基本資料
Version: 1.2.9
Release date: 2011-12-11 13:02 UTC
Description: 測試php指令碼效能的架構(Framework to benchmark PHP scripts or function calls. )
Download: Benchmark pear
安裝與配置
下載檔案後解壓檔案目錄結構如下
運行timer_example.php顯示如下
功能使用
Timer.php
主要函數:
$timer->start() 開始標記 相當於 $timer->setMarker("start')
$timer->setMarker('mark'); 標記 返回頁面時此處標記到上一個標記之間的 時間、百分比$timer->stop() 結束標記 相當於 $timer->setMarker('stop')
$timer->display(); 輸出到頁面
測試 is_file與file_exists效能對比
start();for ($index = 0; $index < 10000; $index++) { //判斷給定檔案名稱是否為一個正常的檔案 is_file($filename);}$timer->setMarker('is_file');for ($index = 0; $index < 10000; $index++) { //檢查檔案或目錄是否存在 file_exists($filename);}$timer->setMarker('file_exists');$timer->stop();$timer->display();
<喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+PGJyPgo8L3A+CjwvYmxvY2txdW90ZT4KPHA+PC9wPgo8cD48YnI+CjwvcD4KPGJsb2NrcXVvdGU+CjxwPjwvcD4KPGgzPkl0ZXJhdGUucGhwPC9oMz4KPGJsb2NrcXVvdGU+CmZ1bmN0aW9uIHJ1bigpICAgINTL0NAxMDC0znVzZXLA4GVhdLe9t6iyorSrss7K/aGudGVzdKGvIMD9o7okYmVuY2htYXJrLT5ydW4oMTAwLCA="user->eat', 'test');
function get() 返回函數每次執行時間和平均時間
run(5, 'o->foo', 'test');$result = $benchmark->get();var_dump($result);?>
http://www.bkjia.com/PHPjc/755791.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/755791.htmlTechArticleBenchmark 基本資料 Version: 1.2.9 Release date: 2011-12-11 13:02 UTC Description: 測試php指令碼效能的架構( Framework to benchmark PHP scripts or function calls. )...