Skip to content

Instantly share code, notes, and snippets.

@preaction
Created May 26, 2010 21:16
Show Gist options
  • Select an option

  • Save preaction/415075 to your computer and use it in GitHub Desktop.

Select an option

Save preaction/415075 to your computer and use it in GitHub Desktop.
use lib '/data/WebGUI/lib';
use warnings;
use strict;
use Time::HiRes qw(usleep);
use WebGUI::Session;
use WebGUI::Asset;
use Devel::Gladiator qw(walk_arena);
use Devel::Size qw(size total_size);
use Data::Dumper;
BEGIN { do '/data/WebGUI/sbin/preload.perl' }
my $table = Devel::Gladiator::arena_ref_counts;
{
use strict;
my ($cycles, $i, $yespi, $pi) = 0;
$cycles = 100;
my ($x, $y, $cdnt) = 0;
while ($i++ < $cycles) {
$x = rand;
$y = rand;
$cdnt = $x**2 + $y**2;
if ($cdnt <= 1) {
++$yespi;
}
}
$pi = ($yespi / $cycles) * 4;
}
my $after = Devel::Gladiator::arena_ref_counts;
for my $key ( keys %{$after} ) {
if ( $table->{$key} && $after->{$key} - $table->{$key} ) {
printf "%60s %9s\n", $key, $after->{$key} - $table->{$key};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment