summaryrefslogtreecommitdiff
path: root/t/TEST
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2011-03-13 13:13:27 -0600
committerFather Chrysostomos <sprout@cpan.org>2011-09-09 20:16:02 -0700
commit8e03ad8f6c24ab6b98b196deca21ee507e4773f7 (patch)
treeeecda090eaa72355abd4dc40ab2006157f961c90 /t/TEST
parentb49055e966b614a7aa5d3eda7075ca3262694b6f (diff)
downloadperl-8e03ad8f6c24ab6b98b196deca21ee507e4773f7.tar.gz
if -d HARNESS_TIMER, t/TEST saves timings in Storable file
if HARNESS_TIMER envar is an existing directory, write timings data and various platform and configuration data to a Storable file. Given a large collection of files, the variance of each test can be determined. The configuration data should be sufficient to compare different builds done on the same box. The platform data will hopefully allow meaningful comparison of tests done on similar boxes, with same or other OS, compiler, memory, etc. Both are subject to change, for both content and format, latter being less important because of the normalization possible during analysis, if the data is there. Harness output still looks the same: t/porting/cmp_version ......................................... ok 757 ms t/porting/diag ................................................ ok 1172 ms t/porting/dual-life ........................................... ok 88 ms t/porting/exec-bit ............................................ ok 86 ms t/porting/filenames ........................................... ok 176 ms t/porting/globvar ............................................. ok 99 ms t/porting/maintainers ......................................... ok 501 ms t/porting/manifest ............................................ ok 251 ms t/porting/podcheck ............................................ ok 15013 ms t/porting/regen ............................................... ok 1033 ms t/porting/test_bootstrap ...................................... ok 36 ms All tests successful. u=11.67 s=5.07 cu=375.07 cs=84.26 scripts=2045 tests=471995 wrote storable file: ../../perf/2011-9-7-2-45.ttimes The Storable file data looks like: $VAR1 = { 'conf' => { 'byacc' => 'byacc', 'cc' => 'cc', 'cccdlflags' => '-fPIC', 'ccdlflags' => '-Wl,-E', ... }, 'host' => 'groucho.jimc.earth', 'perf' => { '../cpan/Archive-Extract/t/01_Archive-Extract.t' => '3960.50214767456', '../cpan/Archive-Tar/t/01_use.t' => '94.3360328674316', '../cpan/Archive-Tar/t/02_methods.t' => '737.880945205688', '../cpan/Archive-Tar/t/03_file.t' => '118.676900863647', '../cpan/Archive-Tar/t/04_resolved_issues.t' => '130.842924118042', ...
Diffstat (limited to 't/TEST')
-rwxr-xr-xt/TEST53
1 files changed, 51 insertions, 2 deletions
diff --git a/t/TEST b/t/TEST
index 30abcf82b9..f8726d9cf9 100755
--- a/t/TEST
+++ b/t/TEST
@@ -795,8 +795,26 @@ SHRDLU_5
}
}
my ($user,$sys,$cuser,$csys) = times;
- print sprintf("u=%.2f s=%.2f cu=%.2f cs=%.2f scripts=%d tests=%d\n",
- $user,$sys,$cuser,$csys,$tested_files,$totmax);
+ my $tot = sprintf("u=%.2f s=%.2f cu=%.2f cs=%.2f scripts=%d tests=%d",
+ $user,$sys,$cuser,$csys,$tested_files,$totmax);
+ print "$tot\n";
+ if ($good_files) {
+ if (-d $show_elapsed_time) {
+ # HARNESS_TIMER = <a-directory>. Save timings etc to
+ # storable file there. NB: the test cds to ./t/, so
+ # relative path must account for that, ie ../../perf
+ # points to dir next to source tree.
+ require Storable;
+ my @dt = localtime;
+ $dt[5] += 1900; $dt[4] += 1; # fix year, month
+ my $fn = "$show_elapsed_time/".join('-', @dt[5,4,3,2,1]).".ttimes";
+ Storable::store({ perf => \%timings,
+ gather_conf_platform_info(),
+ total => $tot,
+ }, $fn);
+ print "wrote storable file: $fn\n";
+ }
+ }
if ($ENV{PERL_VALGRIND}) {
my $s = $valgrind == 1 ? '' : 's';
print "$valgrind valgrind report$s created.\n", ;
@@ -804,4 +822,35 @@ SHRDLU_5
}
exit ($::bad_files != 0);
+# Collect platform, config data that should allow comparing
+# performance data between different machines. With enough data,
+# and/or clever statistical analysis, it should be possible to
+# determine the effect of config choices, more memory, etc
+
+sub gather_conf_platform_info {
+ # currently rather quick & dirty, and subject to change
+ # for both content and format.
+ require Config;
+ my (%conf, @platform) = ();
+ $conf{$_} = $Config::Config{$_} for
+ grep /cc|git|config_arg\d+/, keys %Config::Config;
+ if (-f '/proc/cpuinfo') {
+ open my $fh, '/proc/cpuinfo' or warn "$!: /proc/cpuinfo\n";
+ @platform = grep /name|cpu/, <$fh>;
+ chomp $_ for @platform;
+ }
+ unshift @platform, $^O;
+
+ return (
+ conf => \%conf,
+ platform => {cpu => \@platform,
+ mem => [ grep s/\s+/ /,
+ grep chomp, `free` ],
+ load => [ grep chomp, `uptime` ],
+ },
+ host => (grep chomp, `hostname -f`),
+ version => '0.03', # bump for conf, platform, or data collection changes
+ );
+}
+
# ex: set ts=8 sts=4 sw=4 noet: