Subject: | Allow for negative time to be measured |
Our virtual CentOS-5 (64-bit) machine apparently has an instable clock, which causes Devel::NYTProf to measure negative time for some ops. The attached patch allow for that to happen without failing the tests.
Without this patch we see test failures like this one:
Without this patch we see test failures like this one:
# Failed test 'test06.x match generated CSV data for blocks=1 calls=0 compress=0 leave=0 savesrc=0 slowops=2 start=init use_db_sub=1' # at t/lib/NYTProfTest.pm line 589. # Structures begin differing at: # $got->[26] = '-0.000833,10,-0.000083,while (10 > $y++) {' # $expected->[26] = '0,10,0,while (10 > $y++) {' --- test06.x 2012-12-27 02:50:17.000000000 -0800 +++ test06.x_new 2013-05-20 21:03:32.000000000 -0700 @@ -24,7 +24,7 @@ 0,1,0,my ($x, $y); 0,1,0,while (10 > $x++) { 0,10,0,$y = 0; -0,10,0,while (10 > $y++) { +-0.000833,10,-0.000083,while (10 > $y++) { 0,100,0,noop(); 0,0,0,} 0,0,0,}
Subject: | Devel-NYTProf-negative-time.patch |
From b4f8fe30d073338d420d8ec08a9d62b7ae959e1d Mon Sep 17 00:00:00 2001
From: Gisle Aas <gisle@activestate.com>
Date: Wed, 22 May 2013 15:05:24 -0700
Subject: [PATCH] Allow for negative time to be measured
Our virtual CentOS5 (64-bit) machine apparently has an instable clock, which
causes Devel::NYTProf to measure negative time for some ops. Allow for
that to happen without failing the tests.
---
t/lib/NYTProfTest.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/t/lib/NYTProfTest.pm b/t/lib/NYTProfTest.pm
index 93fc4dc..20bba99 100644
--- a/t/lib/NYTProfTest.pm
+++ b/t/lib/NYTProfTest.pm
@@ -550,7 +550,7 @@ sub verify_csv_report {
next if m/^# Version/; # Ignore version numbers
- s/^([0-9.]+),([0-9.]+),([0-9.]+),(.*)$/0,$2,0,$4/o;
+ s/^(-?[0-9.]+),([0-9.]+),(-?[0-9.]+),(.*)$/0,$2,0,$4/o;
my $t0 = $1;
my $c0 = $2;
my $tc0 = $3;
--
1.7.0.5