2016-11-08 7 views
0

Laravelのいくつかのモジュール/プラグインは、funtions、クエリ、およびリクエスト数の実行時間を測定し、のデータを示します。例えば、Ruby on Rails loggerのようなものですか?クエリと実行関数のパフォーマンスを測定

これがあれば、どうしたらいいですか? Rubyで

、I本:

class ArticlesController < ApplicationController 
    # ... 

    def create 
    @article = Article.new(params[:article]) 
    logger.debug "New article: #{@article.attributes.inspect}" 
    logger.debug "Article should be valid: #{@article.valid?}" 

    if @article.save 
     flash[:notice] = 'Article was successfully created.' 
     logger.debug "The article was saved and now the user is going to be redirected..." 
     redirect_to(@article) 
    else 
     render action: "new" 
    end 
    end 

    # ... 
end 

をそして、それはこれを与える:

Processing ArticlesController#create (for 127.0.0.1 at 2008-09-08 11:52:54) [POST] 
    Session ID: BAh7BzoMY3NyZl9pZCIlMDY5MWU1M2I1ZDRjODBlMzkyMWI1OTg2NWQyNzViZjYiCmZsYXNoSUM6J0FjdGl 
vbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA=--b18cd92fba90eacf8137e5f6b3b06c4d724596a4 
    Parameters: {"commit"=>"Create", "article"=>{"title"=>"Debugging Rails", 
"body"=>"I'm learning how to print in logs!!!", "published"=>"0"}, 
"authenticity_token"=>"2059c1286e93402e389127b1153204e0d1e275dd", "action"=>"create", "controller"=>"articles"} 
New article: {"updated_at"=>nil, "title"=>"Debugging Rails", "body"=>"I'm learning how to print in logs!!!", 
"published"=>false, "created_at"=>nil} 
Article should be valid: true 
    Article Create (0.000443) INSERT INTO "articles" ("updated_at", "title", "body", "published", 
"created_at") VALUES('2008-09-08 14:52:54', 'Debugging Rails', 
'I''m learning how to print in logs!!!', 'f', '2008-09-08 14:52:54') 
The article was saved and now the user is going to be redirected... 
Redirected to # Article:0x20af760> 
Completed in 0.01224 (81 reqs/sec) | DB: 0.00044 (3%) | 302 Found [http://localhost/articles] 

はどんな返事をいただき、ありがとうございます。

答えて

0

xdebugがインストールされている場合は、次の機能を使用できます。

xdebug_start_trace('/path/to/trace/file.log'); 
xdebug_stop_trace(); 
関連する問題