'errorlogFilename' => 'qdmailer_error.log',
));
-/* 携帯ビューの停止(暫定) */
-Configure::write('Mode.Mobile', false);
+/* Benchmarkコンポーネント使用 */
+// guest UserIDでの操作制限
+define('BENCHMARK_MODE', true);
/* デモモード */
// guest UserIDでの操作制限
Configure::write('Mode.Demo', false);
+/* 携帯ビューの停止(暫定) */
+Configure::write('Mode.Mobile', false);
+
/* php.ini設定の上書き */
// mb_string関連
mb_language('Japanese');
var $components = array(
'AuthPlus',
'Acl',
- 'DebugKit.Toolbar',
'Cakeplus.HtmlEscape',
'Token',
'Crypt',
+ 'DebugKit.Toolbar',
+ 'Benchmark'
);
var $helpers = array(
function beforeFilter()
{
+ $this->Benchmark->report($this->params['controller']. '/'. $this->action . ':' .' beforeFilterStart');
+
parent::beforeFilter();
$this->user['User']['name'] = __('Guest', true);
function beforeRender()
{
+ $this->Benchmark->report($this->params['controller']. '/'. $this->action . ':' . ' beforeRenderStart');
parent::beforeRender();
}
+ function afterFilter()
+ {
+ $this->Benchmark->report($this->params['controller']. '/'. $this->action . ':' . ' afterFilterStart');
+ parent::afterFilter();
+ }
+
/* 共通関数 */
/* public_flag設定をview用にセット */
function set_public_flag4view()
--- /dev/null
+<?php
+/*
+ * ベンチマークコンポーネント
+ * Reffer: http://blog.aidream.jp/cakephp/cakephp-benchmark-component-1366.html
+ */
+
+class BenchmarkComponent extends Object {
+ var $id = null;
+ var $start_time = 0;
+
+ //---------------------------------------------------------------------------
+ // コンストラクタ
+ //---------------------------------------------------------------------------
+ function __construct() {
+ $this->id = substr( md5(uniqid(rand(),true)) , 0, 8);
+ $this->report('<==construct', true);
+ }
+
+ //---------------------------------------------------------------------------
+ // デストラクタ
+ //---------------------------------------------------------------------------
+ function __destruct() {
+ $this->report('<==destruct');
+ }
+
+ //---------------------------------------------------------------------------
+ // 計測してログファイルに出力
+ //---------------------------------------------------------------------------
+ function report($message = null, $reset = false) {
+ if (defined('BENCHMARK_MODE') === false || BENCHMARK_MODE === false) {
+ return;
+ }
+ if ($reset === true) {
+ $this->start_time = $this->_getMicroTime();
+ }
+
+ $now = $this->_getMicroTime() - $this->start_time;
+
+ $str = sprintf("[%s] %01.5f : %s :", $this->id, $now, $message);
+ $this->log($str, LOG_DEBUG);
+ }
+
+ //---------------------------------------------------------------------------
+ // マイクロタイムを取得
+ //---------------------------------------------------------------------------
+ function _getMicrotime() {
+ if (phpversion() < 5) {
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+ } else {
+ return microtime(true);
+ }
+ }
+}