Skip to content

Commit

Permalink
统一在check-native-memory-usage.pl脚本里收集整理NMT数据,并对结果进行检查判断,确认是否存在内存泄漏的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
sendaoYan committed Sep 16, 2024
1 parent b4f7519 commit c6ee8f0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,9 @@ if grep -q "Unable to open socket file" *-native_memory-summary.log ; then
exit 1
fi

( set +x ; perl -w ${TESTSRC}/get-native-memory-usage.pl 25 `ls *-native_memory-summary.log | sort -n | xargs` )
generatePlotPNG
( set +x ; perl -w ${TESTSRC}/check-native-memory-usage.pl 25 "Code-malloc:2.6,Code-mmap:2.8,Compiler-malloc:4.6" `ls *-native_memory-summary.log | sort -n | xargs` )
exitCode=$?
generatePlotPNG

mkdir -p native_memory-summary ; mv *-native_memory-summary.log native_memory-summary/

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#usage: perl -w ${TESTSRC}/get-native-memory-usage.pl 25 `ls *-native_memory-summary.log | sort -n | xargs`
#usage: perl -w ${TESTSRC}/get-native-memory-usage.pl 25 "Code-malloc:2.6,Code-mmap:2.8,Compiler-malloc:4.6" `ls *-native_memory-summary.log | sort -n | xargs`
use strict;
use warnings;
use POSIX;
Expand All @@ -28,6 +28,7 @@

die "please input split number and more than 3 jcmd native log files" if( @ARGV < 10 );
my $split = shift(@ARGV);
my $rules = shift(@ARGV);
my $baseline = parserJcmdResult(shift(@ARGV));
my @nameArray;
my %resultCsv;
Expand All @@ -39,6 +40,8 @@
my %resultThirdValue;
my %resultHalfValue;
my %resultLastValue;
my %isIncreasementalResultHash;
my $memoryLeakNumber = 0;
my $plotDataDir = "plot-data";
my $lastFile = $ARGV[-1];
$lastFile =~ /^([0-9]+)-.*?/;
Expand Down Expand Up @@ -126,6 +129,7 @@
my $halfMultiple = sprintf("%.1f", $resultLastValue{$key} / $resultHalfValue{$key});
my $thirdSurprise = "";
my $isIncreasementalResult = isIncreasemental(@data);
$isIncreasementalResultHash{$name} = $isIncreasementalResult;
my $isMemoryLeak = "";
if( $thirdMultiple >= 2.5 )
{
Expand All @@ -151,6 +155,30 @@
close($summaryFh);


my $lastIndexResultHash = parserJcmdResult($ARGV[-1]);
my $thirdIndexResultHash = parserJcmdResult($ARGV[ceil(scalar(@ARGV)/3)]);
foreach my $rule ( split /,/, $rules )
{
print("rule: $rule\n");
my($moduleName, $coefficient) = split /:/, $rule;
print("$moduleName: $coefficient\n") if( $verbose > 3 );
my $lastIndexValue = $lastIndexResultHash->{$moduleName};
my $thirdIndexValue = $thirdIndexResultHash->{$moduleName};
die "can't find $moduleName memory usage information!" if( ! defined $lastIndexValue );
die "can't find $moduleName memory usage information!" if( ! defined $thirdIndexValue );
my $compareValue = $thirdIndexValue * $coefficient;
if( $lastIndexValue > $compareValue && $isIncreasementalResultHash{$moduleName} == 0 )
{
warn("$moduleName: $lastIndexValue > $compareValue=$thirdIndexValue*$coefficient");
$memoryLeakNumber++;
}
}
if( $memoryLeakNumber > 0 )
{
die "memoryLeakNumber=$memoryLeakNumber!";
}



sub parserJcmdResult
{
Expand Down

0 comments on commit c6ee8f0

Please sign in to comment.