Guest User

Untitled

a guest
May 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1.  
  2. use lib '/data/WebGUI/lib';
  3. use warnings;
  4. use strict;
  5. use Time::HiRes qw(usleep);
  6.  
  7. use WebGUI::Session;
  8. use WebGUI::Asset;
  9. use Devel::Gladiator qw(walk_arena);
  10. use Devel::Size qw(size total_size);
  11. use Data::Dumper;
  12.  
  13. BEGIN { do '/data/WebGUI/sbin/preload.perl' }
  14. my $table = Devel::Gladiator::arena_ref_counts;
  15. {
  16. use strict;
  17. my ($cycles, $i, $yespi, $pi) = 0;
  18. $cycles = 100;
  19. my ($x, $y, $cdnt) = 0;
  20. while ($i++ < $cycles) {
  21. $x = rand;
  22. $y = rand;
  23. $cdnt = $x**2 + $y**2;
  24. if ($cdnt <= 1) {
  25. ++$yespi;
  26. }
  27. }
  28. $pi = ($yespi / $cycles) * 4;
  29. }
  30. my $after = Devel::Gladiator::arena_ref_counts;
  31.  
  32. for my $key ( keys %{$after} ) {
  33. if ( $table->{$key} && $after->{$key} - $table->{$key} ) {
  34. printf "%60s %9s\n", $key, $after->{$key} - $table->{$key};
  35. }
  36. }
Add Comment
Please, Sign In to add comment