php pear Benchmark_PHP教程

來源:互聯網
上載者:User

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. )...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.