10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

FuelPHPでexec_timeとかmem_usageを出す仕組みが雑すぎる

Last updated at Posted at 2014-02-06

public/index.php の下部に、以下のコードがある。

// This will add the execution time and memory usage to the output.
// Comment this out if you don't use it.
if (strpos($response->body(), '{exec_time}') !== false or strpos($response->body(), '{mem_usage}') !== false)
{
	$bm = Profiler::app_total();
	$response->body(
		str_replace(
			array('{exec_time}', '{mem_usage}'),
			array(round($bm[0], 4), round($bm[1] / pow(1024, 2), 3)),
			$response->body()
		)
	);
}

{exec_time}とか{mem_usage}とかをViewに書いておいたら、実行時間とかメモリ使用量が出せるデバッグ用の仕組みっぽいんだけど「使わなかったら消してね!」ってコメントに書いてあるおおらかな感じ… 教えてもらうまで知らなかった。

アクセスするたび、HTMLを毎回str_replaceってちょっと雑すぎじゃない? って思うし、気づいてコード削除してなかったらコメント欄に {exec_time} って入れて、リロードするたび数字が変わる不思議

10
10
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?