On Friday, February 11, 2011 17:20:07 Perrin Harkins wrote:
> I used to be a big proponent of ASL, but I rely on it less since years
> ago when you pointed out that the shared sizes were not accurate on
> Linux. I know that Smaps helps with that, but it seems fairly
> expensive so I've avoided it.
To assess how expensive it is, here is a comparison. I compare reading 24927
bytes from /proc/$$/smaps, from a plain file and from /dev/urandom the pseudo
random number generator in kernel:
$ perl -MBenchmark=:all,:hireswallclock -e '
cmpthese timethese -10, {
file=>sub{open my $f, "<", "xx" or die; $/=\24927;
24927==length readline $f or die},
smaps=>sub{open my $f, "<", "/proc/".$ARGV[0]."/smaps" or die; $/=\24927;
24927==length readline $f or die},
urandom=>sub{open my $f, "<", "/dev/urandom" or die; $/=\24927;
24927==length readline $f or die}}' $$
Benchmark: running file, smaps, urandom for at least 10 CPU seconds...
file: 12.4656 wallclock secs ( 7.94 usr + 4.45 sys = 12.39 CPU) @
47120.02/s (n=583817)
smaps: 10.1048 wallclock secs ( 0.59 usr + 9.50 sys = 10.09 CPU) @
3287.22/s (n=33168)
urandom: 11.618 wallclock secs ( 0.03 usr + 11.57 sys = 11.60 CPU) @
198.28/s (n=2300)
Rate urandom smaps file
urandom 198/s -- -94% -100%
smaps 3287/s 1558% -- -93%
file 47120/s 23665% 1333% --
Torsten Förtsch
--
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net