Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- #use Term::ReadKey;
- sub checkLimit($$$){
- my ($p_a, $p_limit, $p_res) = @_;
- foreach (@{$p_a}) {
- push(@{$p_res}, $_) if $_ > $p_limit;
- }
- }
- my @a;
- for ( my $c = 0; $c < 100000; $c++ ) {
- $a[$c] = rand();
- print "$c " unless $c % 1000;
- print "\n" unless $c % 10000;
- }
- print "\n";
- printf("Data filled %s, check the memory. ex.: memstat -w -p %s\n",$#a,$$);
- system("memstat -w -p $$");
- print "Start dta check\n";
- for ( my $x = 0; $x < 6; $x++ ){
- print "round: $x\n\n";
- my $limit;
- my @res;
- foreach $limit ( map { 0.01 * $_ } 1..100 ) {
- checkLimit(\@a, \$limit, \@res);
- # printf ("limit %0.3f count %d\n", $limit, $#res);
- @res = ();
- }
- #undef @res;
- printf("Pls check again the memory usage. ex.: memstat -w -p %s\n",$$);
- system("memstat -w -p $$");
- }
Advertisement
Add Comment
Please, Sign In to add comment