Ethna_Plugin_Filter_Bench

使い方とか

/halt/Snapshot - Ethna_Plugin_Filter_Benchを参考にしてください。

必要なライブラリ

PEAR::Benchmarkが必要です。

ソースコード


/**
 *  実行時間計測フィルタの実装
 *
 *  @author     halt feits
 *  @access     public
 *  @package    Ethna
 */
class Ethna_Plugin_Filter_Bench extends Ethna_Plugin_Filter
{
   var $bm;
   var $use_bm = true;

   /**
    *  実行前フィルタ
    *
    *  @access public
    */
   function preFilter()
   {
       if ($this->use_bm) {
           require_once 'Benchmark/Timer.php';
           $this->bm =& new Benchmark_Timer();
           $this->bm->start();
       }
   }

   function preActionFilter()
   {
       if ($this->use_bm) {
           $this->bm->setMarker('preAction');
       }
   }

   function postActionFilter()
   {
       if ($this->use_bm) {
           $this->bm->setMarker('postAction');
       }
   }

   /**
    *  実行後フィルタ
    *
    *  @access public
    */
   function postFilter()
   {
       if ($this->use_bm) {
           $this->bm->stop();
           $this->logger->log(LOG_NOTICE, "[{$_SERVER['REQUEST_URI']}] {$this->bm->getOutput(false, 'plain')}");
       }
   }
}
トップページ
新規作成
編集
履歴
ページ一覧

アクセスの多いページ

Recent changes