我正在尝试分析一个Perl脚本,但是CORE :: sleep吞噬了我报告的所有空间(和时间)。
我如何告诉NYTProf忽略睡眠呼叫?
假设我们有以下脚本:
sub BrandNewSubroutine {
sleep 10;
print "Odelay\n";
}
BrandNewSubroutine();
我想摆脱报告的以下几行:
编辑:使用DB :: disable_profile()和DB :: enable_profile()不会起作用,因为它会将睡眠时间添加到BrandNewSubroutine Inclusive时间。
提前致谢。
答案 0 :(得分:3)
我建议使用sleep
和DB::disable_profile()
来电(perlsub将DB::enable_profile()
的调用(可能是使用RUN-TIME CONTROL OF PROFILING in NYTProf documentation中提到的方法)包裹起来),或者处理报告以删除违规电话。
答案 1 :(得分:0)
CORE :: accept已经被你想要CORE :: sleep的方式忽略了,所以机制已经到位了。请参阅NYTProf.xs中的此代码:
/* XXX make configurable eg for wait(), and maybe even subs like FCGI::Accept
* so perhaps use $hide_sub_calls->{$package}{$subname} to make it general.
* Then the logic would have to move out of this block.
*/
if (OP_ACCEPT == op_type)
subr_entry->hide_subr_call_time = 1;
因此,通过一点点黑客攻击(OP_SLEEP == op_type || OP_ACCEPT == op_type),您可以以相同的方式忽略CORE :: sleep。
我accept a patch将其作为选项启用。