in reply to Re^4: leak detection in other (non-perl) processes
in thread leak detection in other (non-perl) processes

Maybe something like this will get you started. Try playing with the threshhold and moving average period (see examples):

#! perl -slw use strict; use List::Util qw[ sum min max reduce ]; my %cases = ( A => [ qw[ 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 1 +7 17 17 17 17 17 ] ], B => [ qw[ 17 17 17 17 17 17 17 17 17 17 17 17 16 17 17 17 17 17 1 +7 17 17 17 17 17 ] ], C => [ qw[ 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 1 +7 17 17 17 17 25 ] ], D => [ qw[ 17 20 17 20 17 20 17 20 17 20 17 20 17 20 17 20 17 20 1 +7 20 17 20 17 20 ] ], E => [ qw[ 17 20 34 29 36 22 18 25 19 19 19 43 52 37 28 19 17 17 1 +7 20 17 27 36 47 ] ], F => [ qw[ 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 7 +1 74 77 80 83 86 ] ], G => [ qw[ 17 20 20 26 25 26 30 34 38 41 44 39 42 46 50 58 52 55 5 +5 55 55 56 59 58 ] ], ); our $V //= 0; our $THRESHHOLD //= 1.1; our $MOVING //= 5; for my $case ( sort keys %cases ) { my $v = $cases{ $case }; my @moving = map{ sprintf "%.2f", sum( @{ $v }[ $_ .. $_+$MOVING ] ) / $MOVING } 0 .. $#$v - $MOVING; my $min = min @moving; my $max = max @moving; my $leak = 'no leak'; if( $moving[ 0 ] == $min and $moving[ -1 ] == $max and ( $min * $THRESHHOLD ) < $max ) { $leak = 'a leak '; } printf "Case $case has %s %s\n", $leak, $V ? "[ @moving ]" : ''; } __END__ [20:34:52.28] C:\test>junk47 -THRESHHOLD=1.10 -MOVING=5 Case A has no leak Case B has no leak Case C has no leak Case D has no leak Case E has no leak Case F has a leak Case G has a leak [20:35:07.79] C:\test>junk47 -THRESHHOLD=1.07 -MOVING=5 Case A has no leak Case B has no leak Case C has a leak Case D has no leak Case E has no leak Case F has a leak Case G has a leak [20:35:16.82] C:\test>junk47 -THRESHHOLD=1.07 -MOVING=15 Case A has no leak Case B has no leak Case C has no leak Case D has no leak Case E has no leak Case F has a leak Case G has a leak [20:35:25.46] C:\test>junk47 -THRESHHOLD=1.03 -MOVING=15 Case A has no leak Case B has no leak Case C has no leak Case D has no leak Case E has no leak Case F has a leak Case G has a leak [20:35:32.66] C:\test>junk47 -THRESHHOLD=1.025 -MOVING=15 Case A has no leak Case B has no leak Case C has a leak Case D has no leak Case E has no leak Case F has a leak Case G has a leak

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?