Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
10
Help us understand the problem. What is going on with this article?
@moroya

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

More than 3 years have passed since last update.

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
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
moroya
アキバではたらくWebエンジニア。最近はディレクターはじめました。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
10
Help us understand the problem. What is going on with this article?