Also how do you benchmark::timer the subroutine:
my @acc_array;
foreach(@somearray){
if($cond ==1) {
my $a = Benchmark::Timer->new(skip => 0);
$a->start('tag');
@acc_array = &some_long_running_func($_);
$a->stop('tag');
print $a->report;
}
}
Print this:
Processed: 1
tag still running at mycode.pl line 223
Processed: 2
tag still running at mycode.pl line 223
Instead of giving the time. What's wrong with my code? | [reply] [d/l] [select] |
There doesn't appear to be anything wrong with your code. It would perhaps be easier to diagnose if we knew which line of your snippet was line 223?
That said, I generally create a single B::T object at the beginning of the program and the call report at the end. That allows me to time several portions of the code by using different tags.
I can't see how your use of close scoping would affect the outcome or produce the error you're seeing, but I thought I'd mention it anyway.
If you don't want to post the real code, then I think you will have to try and produce a small testcase that reproduces the behaviour before we can help you further.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
| [reply] [d/l] [select] |
Hi
It seems that Benchmark::Timer is what I need, but having read your comment:
with little impact upon it
I am a bit cautious. What do you mean by that? Is it harmful? | [reply] |
| [reply] |