diff --git a/test/hotspot/jtreg/compiler/codecache/stress/CodecacheMemoryCheck.sh b/test/hotspot/jtreg/compiler/codecache/stress/CodecacheMemoryCheck.sh index 22769c046f98c..222e52bf6d3ce 100755 --- a/test/hotspot/jtreg/compiler/codecache/stress/CodecacheMemoryCheck.sh +++ b/test/hotspot/jtreg/compiler/codecache/stress/CodecacheMemoryCheck.sh @@ -112,8 +112,8 @@ useJcmdPrintMemoryUsage() break else if kill -0 $$ ; then - echo "jcmd command execute fail!" - exit 1 + echo "jcmd command execute fail!" + exit 1 else mv ${i}-native_memory-summary.log jcmd-error.log break @@ -205,7 +205,7 @@ pid=$! ps -ef | grep java | grep UnexpectedDeoptimizationTestLoop &> ps-java.log getMemoryUsageFromProc ${pid} java.log 2> proc-detail-stderr.log & useJcmdPrintMemoryUsage ${pid} java.log 2> jcmd-detail-stderr.log -if grep -q "Unable to open socket file" *-native_memory-summary.log ; then +if ( set +x ; grep -q "Unable to open socket file" *-native_memory-summary.log ) ; then echo 'jcmd report error: "-native_memory-summary.log"' exit 1 fi diff --git a/test/hotspot/jtreg/compiler/codecache/stress/get-native-memory-usage.pl b/test/hotspot/jtreg/compiler/codecache/stress/get-native-memory-usage.pl index 2bfeb3ea3b1c8..faf4106bce047 100755 --- a/test/hotspot/jtreg/compiler/codecache/stress/get-native-memory-usage.pl +++ b/test/hotspot/jtreg/compiler/codecache/stress/get-native-memory-usage.pl @@ -117,18 +117,12 @@ die "key=$key != name=$name" if( $name ne $key ); print $csvFh "$resultCsv{$key}\n"; - my $minValue = $resultMinValue{$key}; - if( $minValue == 0 ) - { - print("$key minimum vaule is $minValue, the minimum value will set to 0.01 to log file.\n"); - $minValue = 0.01; - } - my $maxMultiple = sprintf("%.1f", $resultMaxValue{$key} / $minValue); + my $maxMultiple = sprintf("%.1f", $resultMaxValue{$key} / $resultMinValue{$key}); my $quarterMultiple = sprintf("%.1f", $resultLastValue{$key} / $resultQuarterValue{$key}); my $thirdMultiple = sprintf("%.1f", $resultLastValue{$key} / $resultThirdValue{$key}); my $halfMultiple = sprintf("%.1f", $resultLastValue{$key} / $resultHalfValue{$key}); my $thirdSurprise = ""; - my $isIncreasementalResult = isIncreasemental(@data); + my $isIncreasementalResult = isIncreasemental($name, @data); $isIncreasementalResultHash{$name} = $isIncreasementalResult; my $isMemoryLeak = ""; if( $thirdMultiple >= 2.5 ) @@ -139,7 +133,7 @@ $isMemoryLeak = "\tMemoryLeak!!!" } } - print $summaryFh "$key\tmax=$resultMaxValue{$key},index=$resultMaxIndex{$key}\tmin=$minValue,index=$resultMinIndex{$key}\tquarter=$resultQuarterValue{$key},third=$resultThirdValue{$key},half=$resultHalfValue{$key}\tmax/min=$maxMultiple,last/quarter=$quarterMultiple,last/half=$halfMultiple,last/third=$thirdMultiple$thirdSurprise\tisIncreasemental=$isIncreasementalResult$isMemoryLeak\n"; + print $summaryFh "$key\tmax=$resultMaxValue{$key},index=$resultMaxIndex{$key}\tmin=$resultMinValue{$key},index=$resultMinIndex{$key}\tquarter=$resultQuarterValue{$key},third=$resultThirdValue{$key},half=$resultHalfValue{$key}\tmax/min=$maxMultiple,last/quarter=$quarterMultiple,last/half=$halfMultiple,last/third=$thirdMultiple$thirdSurprise\tisIncreasemental=$isIncreasementalResult$isMemoryLeak\n"; #write plot data my $i = 0; @@ -203,6 +197,14 @@ sub parserJcmdResult die "filename=$filename\tline=$line can't get name!\n" if( length($name) <= 0 ); my $key = "$name" . "-malloc"; print("name=$key\t\tnumber=$number\n") if( $verbose == 1 ); + if( $number == 0 ) + { + if( $verbose > 0 ) + { + warn("$key value is 0"); + } + $number = 0.01; + } $malloc{$key} = $number; next; } @@ -212,6 +214,14 @@ sub parserJcmdResult die "filename=$filename\tline=$line can't get name!\n" if( length($name) <= 0 ); my $key = "$name" . "-mmap"; print("name=$key\t\tnumber=$number\n") if( $verbose == 1 ); + if( $number == 0 ) + { + if( $verbose > 0 ) + { + warn("$key value is 0"); + } + $number = 1; + } $malloc{$key} = $number; next; } @@ -222,12 +232,13 @@ sub parserJcmdResult sub isIncreasemental { + my $name = shift(@_); my @array = @_; my $length = scalar(@array); my $windowLength = floor($length/$split); - warn("windowLength=$windowLength\n") if( $verbose > 0 ); + warn("$name: windowLength=$windowLength\n") if( $verbose > 0 ); my $count = $windowLength * $split; - warn("count=$count, $length=$length\n") if( $verbose > 0 );; + warn("$name: count=$count, $length=$length\n") if( $verbose > 0 );; my $previousSum = 0; my $steady = 0; my $result = 0; @@ -242,11 +253,11 @@ sub isIncreasemental $currentSum += $array[$i*$windowLength+$j]; } $currentSum /= $windowLength; - warn("currentSum=$currentSum, previousSum=$previousSum\n") if( $verbose >= 3 ); + warn("$name: currentSum=$currentSum, previousSum=$previousSum\n") if( $verbose >= 3 ); if( $currentSum < $previousSum ) { $result++; - warn("currentSum=$currentSum, previousSum=$previousSum\n") if( $verbose >= 1 ); + warn("$name: currentSum=$currentSum, previousSum=$previousSum\n") if( $verbose >= 1 ); } elsif( $currentSum == $previousSum ) { @@ -255,25 +266,33 @@ sub isIncreasemental $previousSum = $currentSum; } + # warn("$name: steady=$steady, split=$split\n") if( $verbose >= 0 ); #calculate the tail data - my $currentSum = 0; - foreach my $i ( $count .. ($length-1) ) - { - $currentSum += $array[$i];; - } - $currentSum /= ($length-$count); - if( $currentSum < $previousSum ) + if( ($length-$count) != 0 ) { - $result++; - warn("currentSum=$currentSum, previousSum=$previousSum\n") if( $verbose >= 1 ); + my $currentSum = 0; + foreach my $i ( $count .. ($length-1) ) + { + $currentSum += $array[$i];; + } + $currentSum /= ($length-$count); + if( $currentSum < $previousSum ) + { + $result++; + warn("$name: currentSum=$currentSum, previousSum=$previousSum\n") if( $verbose >= 1 ); + } + elsif( $currentSum == $previousSum || abs($currentSum-$previousSum) > 0.1 ) + { + $steady++; + } } - elsif( $currentSum == $previousSum ) + else { - $steady++; + warn("$name: tail count is zero.\n") if( $verbose >= 1 ); } #statistics the result - warn("steady=$steady, split=$split\n") if( $verbose >= 2 ); + warn("$name: steady=$steady, split=$split\n") if( $verbose >= 2 ); if( $steady == $split ) { $result = -1;