From cc56d8af31776d43944d6c95ca31d299e4b515dd Mon Sep 17 00:00:00 2001 From: sendaoYan Date: Tue, 17 Sep 2024 09:56:01 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=95=B0=E6=8D=AE=E9=87=8F=E6=9C=89?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E8=A2=ABsplit=E6=95=B4=E9=99=A4=EF=BC=8C?= =?UTF-8?q?=E5=9B=A0=E6=AD=A4tail=E9=83=A8=E5=88=86=E6=9C=89=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E4=B8=BA=E9=9B=B6=EF=BC=9B2.=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=B0=86=E8=8E=B7=E5=8F=96=E7=BB=93=E6=9E=9C=E4=B8=BA0?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E7=BD=AE=E4=B8=BA1=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=90=8E=E7=BB=AD=E5=87=BA=E7=8E=B0=E9=99=A4?= =?UTF-8?q?=E9=9B=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codecache/stress/CodecacheMemoryCheck.sh | 6 +- .../stress/get-native-memory-usage.pl | 69 ++++++++++++------- 2 files changed, 47 insertions(+), 28 deletions(-) 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;