我需要分析rake任务。因为我不是菜鸟,我只知道如何分析.rb代码
像这样:ruby -Ilib -S ruby-prof -p graph_html profile.rb > profile.html
但是,如何配置特定的Rake任务?
最佳答案
Rake只是一个Ruby脚本,因此您应该能够像对其他脚本进行概要分析一样,对ruby调用rake-prof。
鉴于您调用了ruby-prof,请尝试:
ruby -Ilib -S ruby-prof -p graph_html `which rake` TASK > profile.html
我刚刚使用了以下命令行:
ruby-prof -p graph_html /usr/local/bin/rake19 import_from_aws file=~/sourcedata batch=test1 > /tmp/profile.html
概要分析以下内容的调用:
rake19 import_from_aws file=~/sourcedata batch=test1
关于rake - 如何剖析Rake任务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4200041/