Front page | perl.perl5.porters |
Postings from February 2004
[perl #26995] Benchmark for child processes
From:
Chia-liang Kao
Date:
February 23, 2004 19:10
Subject:
[perl #26995] Benchmark for child processes
Message ID:
rt-3.0.8-26995-79126.10.5294106542367@perl.org
# New Ticket Created by Chia-liang Kao
# Please include the string: [perl #26995]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=26995 >
This is a bug report for perl from clkao@clkao.org,
generated with the help of perlbug 1.26 running under perl 5.008003.
-----------------------------------------------------------------
[Please enter your report here]
Here's patch to make Benchmark easier to be abused to benchmark external commands
in addition to perl code. It makes cmpthese and timestr use time statistics for children
instead of parent when the style is 'nop'.
--- lib/Benchmark.pm.orig Fri Feb 20 20:51:04 2004
+++ lib/Benchmark.pm Sun Feb 22 23:38:13 2004
@@ -594,7 +594,8 @@
$r,$pu,$ps,$pt) if $style eq 'noc';
$s=sprintf("$w wallclock secs (%$f cusr + %$f csys = %$f CPU)",
$r,$cu,$cs,$ct) if $style eq 'nop';
- $s .= sprintf(" @ %$f/s (n=$n)", $n / ( $pu + $ps )) if $n && $pu+$ps;
+ $s .= sprintf(" @ %$f/s (n=$n)", $n / ( $style eq 'nop' ? $cu + $cs : $pu + $ps ))
+ if $n && ($style eq 'nop' ? $cu+$cs : $pu+$ps);
$s;
}
@@ -882,7 +883,8 @@
for (@vals) {
# The epsilon fudge here is to prevent div by 0. Since clock
# resolutions are much larger, it's below the noise floor.
- my $rate = $_->[6] / ( $_->[2] + $_->[3] + 0.000000000000001 );
+ my $rate = $_->[6] / (( $style eq 'nop' ? $_->[4] + $_->[5]
+ : $_->[2] + $_->[3]) + 0.000000000000001 );
$_->[7] = $rate;
}
[Please do not change anything below this line]
-----------------------------------------------------------------
---
This perlbug was built using Perl 5.00503 - Sun Mar 5 13:39:27 SAST 2000
It is being executed now by Perl 5.008003 - Sun Feb 22 23:01:53 CST 2004.
Site configuration information for perl 5.008003:
Configured by clkao at Sun Feb 22 23:01:53 CST 2004.
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
Platform:
osname=freebsd, osvers=4.9-prerelease, archname=i386-freebsd-thread-multi
uname='freebsd home.clkao.org 4.9-prerelease freebsd 4.9-prerelease #2: fri sep 5 20:09:04 cst 2003 clkao@home.clkao.org:usrsrcsyscompilehome i386 '
config_args='-sde -Dusethreads=y'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include',
optimize='-O',
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.4 20020320 [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-pthread -Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil -lc_r
perllibs=-lm -lcrypt -lutil -lc_r
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl 5.008003:
/usr/local/lib/perl5/5.8.3/i386-freebsd-thread-multi
/usr/local/lib/perl5/5.8.3
/usr/local/lib/perl5/site_perl/5.8.3/i386-freebsd-thread-multi
/usr/local/lib/perl5/site_perl/5.8.3
/usr/local/lib/perl5/site_perl
.
---
Environment for perl 5.008003:
HOME=/root
LANG (unset)
LANGUAGE (unset)
LC_CTYPE=zh_TW.Big5
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
PERL_BADLANG (unset)
SHELL=/bin/csh
-
[perl #26995] Benchmark for child processes
by Chia-liang Kao