Skip to content

Commit

Permalink
pagealloc: dashboard support
Browse files Browse the repository at this point in the history
Signed-off-by: Mel Gorman <mgorman@suse.de>
  • Loading branch information
Mel Gorman committed Nov 3, 2014
1 parent 86ecd9d commit d3a21cc
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 178 deletions.
33 changes: 18 additions & 15 deletions bin/lib/MMTests/Extract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ use constant DATA_TIME_SECONDS => 1;
use constant DATA_TIME_NSECONDS => 2;
use constant DATA_TIME_USECONDS => 3;
use constant DATA_TIME_MSECONDS => 4;
use constant DATA_ACTIONS => 5;
use constant DATA_ACTIONS_PER_SECOND => 6;
use constant DATA_ACTIONS_PER_MINUTE => 7;
use constant DATA_OPS_PER_SECOND => 8;
use constant DATA_OPS_PER_MINUTE => 9;
use constant DATA_RECORDS_PER_SECOND => 10;
use constant DATA_MBITS_PER_SECOND => 11;
use constant DATA_MBYTES_PER_SECOND => 12;
use constant DATA_TRANS_PER_SECOND => 13;
use constant DATA_SUCCESS_PERCENT => 14;
use constant DATA_WALLTIME => 15;
use constant DATA_WALLTIME_VARIABLE => 16;
use constant DATA_WALLTIME_OUTLIERS => 17;
use constant DATA_OPSSEC => 18;
use constant DATA_THROUGHPUT => 19;
use constant DATA_TIME_CYCLES => 5;
use constant DATA_ACTIONS => 6;
use constant DATA_ACTIONS_PER_SECOND => 7;
use constant DATA_ACTIONS_PER_MINUTE => 8;
use constant DATA_OPS_PER_SECOND => 9;
use constant DATA_OPS_PER_MINUTE => 10;
use constant DATA_RECORDS_PER_SECOND => 11;
use constant DATA_MBITS_PER_SECOND => 12;
use constant DATA_MBYTES_PER_SECOND => 13;
use constant DATA_TRANS_PER_SECOND => 14;
use constant DATA_SUCCESS_PERCENT => 15;
use constant DATA_WALLTIME => 16;
use constant DATA_WALLTIME_VARIABLE => 17;
use constant DATA_WALLTIME_OUTLIERS => 18;
use constant DATA_OPSSEC => 19;
use constant DATA_THROUGHPUT => 20;
use VMR::Stat;
use MMTests::PrintGeneric;
use MMTests::PrintHtml;
Expand Down Expand Up @@ -62,6 +63,8 @@ sub printDataType() {
$yaxis = "Time (msec)";
} elsif ($self->{_DataType} == DATA_TIME_SECONDS) {
$yaxis = "Time (seconds)";
} elsif ($self->{_DataType} == DATA_TIME_CYCLES) {
$yaxis = "Time (cpu cycles)";
} elsif ($self->{_DataType} == DATA_ACTIONS) {
$yaxis = "Actions";
$units = "VarAction";
Expand Down
195 changes: 40 additions & 155 deletions bin/lib/MMTests/ExtractPagealloc.pm
Original file line number Diff line number Diff line change
@@ -1,187 +1,72 @@
# ExtractPagealloc.pm
package MMTests::ExtractPagealloc;
use MMTests::Extract;
our @ISA = qw(MMTests::Extract);
use MMTests::SummariseMultiops;
our @ISA = qw(MMTests::SummariseMultiops);

use constant DATA_PAGEALLOC => 100;
use VMR::Stat;
use strict;

sub new() {
my $class = shift;
my $self = {
_ModuleName => "ExtractPagealloc",
_DataType => DATA_PAGEALLOC,
_ResultData => []
};
bless $self, $class;
return $self;
}


sub initialise() {
my ($self, $reportDir, $testName) = @_;
my @orders;

my @files = <$reportDir/noprofile/alloc-[0-9]*>;
foreach my $file (@files) {
my @split = split /-/, $file;
push @orders, $split[-1];
}
@orders = sort @orders;
$self->{_Orders} = \@orders;

my $fieldLength = 17;
$self->{_FieldLength} = $fieldLength;
$self->{_FieldHeaders} = ["Oper-Batch"];
$self->{_FieldFormat} = [ "%${fieldLength}s" ];
foreach my $order (@orders) {
push @{$self->{_FieldHeaders}}, "order-$order";
push @{$self->{_FieldFormat}}, "%${fieldLength}d";
}
$self->SUPER::initialise();

$self->{_TestName} = $testName;
$self->{_SummaryLength} = $fieldLength;
$self->{_SummaryHeaders} = $self->{_FieldHeaders};
$self->{_PlotLength} = $fieldLength;
$self->{_PlotHeaders} = ["Batch", "Alloc", "Free"];
}

sub printDataType() {
print "PageAlloc";
}

sub printReport() {
my ($self) = @_;
my @data = @{$self->{_ResultData}};
my @orders = @{$self->{_Orders}};
my @batches = @{$self->{_Batches}};
my $operationIndex = 0;
my $fieldLength = $self->{_FieldLength};
my $samples = scalar @{$data[0][$orders[0]][1]};

foreach my $operation ("alloc", "free", "total") {
foreach my $batch (@batches) {
for (my $i = 0; $i < $samples; $i++) {
my @row;
push @row, "$operation-$batch";
$self->{_DataType} = MMTests::Extract::DATA_TIME_CYCLES;
$self->{_PlotXaxis} = "MemSize";
$self->{_PlotType} = "client-errorlines";
$self->{_TestName} = $testName;
$self->{_FilterNaN} = 1;

foreach my $order (@orders) {
push @row, $data[$operationIndex][$order][$batch][$i];
}
push @{$self->{_FlatResultData}}, \@row;
}
}
$operationIndex++;
}
$self->{_PrintHandler}->printRow($self->{_FlatResultData}, $self->{_FieldLength}, $self->{_FieldFormat});
$self->SUPER::initialise($reportDir, $testName);
}

sub extractSummary() {
my ($self, $subHeading) = @_;
my @data = @{$self->{_ResultData}};
my @orders = @{$self->{_Orders}};
my @batches = @{$self->{_Batches}};
my $operationIndex = 0;

foreach my $operation ("alloc", "free", "total") {
foreach my $batch (@batches) {
my (@means, @stddevs);
my @row;
foreach my $order (@orders) {
$means[$order] = calc_trimoutlier_mean(@{$data[$operationIndex][$order][$batch]});
$stddevs[$order] = calc_stddev(@{$data[$operationIndex][$order][$batch]});
}

push @row, "$operation-$batch";
foreach my $order (@orders) {
push @row, $means[$order];
}
push @{$self->{_SummaryData}}, \@row;

if ($ENV{"MMTESTS_PAGEALLOC_PERCENTAGE"} ne "") {
my @row;
push @row, "$operation-$batch+-%age";
sub extractReport($$$) {
my ($self, $reportDir, $reportName) = @_;
my %samples;

foreach my $order (@orders) {
if ($means[$order] == 0) {
push @row, 0;
} else {
push @row, ($stddevs[$order]*100)/$means[$order];
}
}
push @{$self->{_SummaryData}}, \@row;
}
}
$operationIndex++;
my @orders;
my @files = <$reportDir/noprofile/alloc-[0-9]*>;
foreach my $file (@files) {
my @split = split /-/, $file;
push @orders, $split[-1];
}
@orders = sort @orders;

return 1;
}

sub printPlot() {
my ($self, $subheading) = @_;
my $fieldLength = $self->{_PlotLength} - 1;
my @data = @{$self->{_ResultData}};
my @batches = @{$self->{_Batches}};
my (@allocs, @frees, @batch_sizes);
open(INPUT, "$reportDir/noprofile/pagealloc.log") || die("Failed to open pagealloc.log\n");

my $order = $subheading;
$order =~ s/order-//;
while (!eof(INPUT)) {
my $line = <INPUT>;
my @elements = split(/\s+/, $line);

foreach my $batch (@batches) {
my $alloc_mean = calc_trimoutlier_mean(@{$data[0][$order][$batch]});
my $free_mean = calc_trimoutlier_mean(@{$data[1][$order][$batch]});
my $order = $elements[1];
my $batch = $elements[3];
my $latency_alloc = $elements[5];
my $latency_free = $elements[7];
my $latency_total = $latency_alloc + $latency_free;

if ($alloc_mean =~ /\d/) {
printf("%-${fieldLength}d %${fieldLength}.2f %${fieldLength}.2f\n",
$batch, $alloc_mean, $free_mean)
$samples{$batch}++;
if ($samples{$batch} == 1) {
push @batch_sizes, $batch;
}
}
}

sub extractReport($$$) {
my ($self, $reportDir, $reportName) = @_;
my $file = "$reportDir/noprofile/time";
my @data = ([]);
my $operationIndex = 0;
my @orders = @{$self->{_Orders}};
my %hashBatches;

foreach my $operation ("alloc", "free") {
foreach my $order (@orders) {
my $inputFile = "$reportDir/noprofile/$operation-$order";
open(INPUT, $inputFile) || die ("Failed to open $inputFile");
while (<INPUT>) {
my ($batch, $latency) = split (/ /, $_);
$hashBatches{$batch} = 1;
chomp($latency);
push @{$data[$operationIndex][$order][$batch]}, $latency;
}
close INPUT;
if ($samples{$batch} >= 3) {
push @{$self->{_ResultData}}, ["alloc-odr$order-$batch", $samples{$batch} - 3, $latency_alloc];
push @{$self->{_ResultData}}, ["free-odr$order-$batch", $samples{$batch} - 3, $latency_free];
push @{$self->{_ResultData}}, ["total-odr$order-$batch", $samples{$batch} - 3, $latency_total];
}
$operationIndex++;
}

# Calculate the totals operation
my @batches = sort { $a <=> $b } keys(%hashBatches);
$self->{_Batches} = \@batches;
foreach my $batch (@batches) {
my @ops;
foreach my $operation ("alloc", "free", "total") {
foreach my $order (@orders) {
my $total = 0;

if (!defined($data[0][$order][$batch])) {
next;
}

my @allocs = @{$data[0][$order][$batch]};
my @frees = @{$data[1][$order][$batch]};

for (my $i = 0; $i <= $#allocs; $i++) {
push @{$data[$operationIndex][$order][$batch]}, $allocs[$i] + $frees[$i];
foreach my $batch_size (@batch_sizes) {
push @ops, "$operation-odr$order-$batch_size";
}
}
}
$self->{_ResultData} = \@data;
$self->{_Operations} = \@ops;
}

1;
22 changes: 16 additions & 6 deletions bin/lib/MMTests/SummariseMultiops.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ sub initialise() {
if ($self->{_DataType} == MMTests::Extract::DATA_TIME_SECONDS ||
$self->{_DataType} == MMTests::Extract::DATA_TIME_NSECONDS ||
$self->{_DataType} == MMTests::Extract::DATA_TIME_MSECONDS ||
$self->{_DataType} == MMTests::Extract::DATA_TIME_USECONDS) {
$self->{_DataType} == MMTests::Extract::DATA_TIME_USECONDS ||
$self->{_DataType} == MMTests::Extract::DATA_TIME_CYCLES) {
$self->{_MeanOp} = "calc_mean";
$self->{_MeanName} = "Amean";
$self->{_RatioPreferred} = "Lower";
Expand Down Expand Up @@ -141,9 +142,14 @@ sub extractSummary() {
push @row, $operation;
foreach my $funcName ("calc_min", $self->{_MeanOp}, "calc_stddev", "calc_coeffvar", "calc_max") {
no strict "refs";
push @row, &$funcName(@units);
my $value = &$funcName(@units);
if (($value ne "NaN" && $value ne "nan") || $self->{_FilterNaN} != 1) {
push @row, $value;
}
}
if ($#row > 1) {
push @{$self->{_SummaryData}}, \@row;
}
push @{$self->{_SummaryData}}, \@row;

}

Expand Down Expand Up @@ -181,10 +187,14 @@ sub extractRatioSummary() {
push @row, $operation;
foreach my $funcName ($self->{_MeanOp}) {
no strict "refs";
push @row, &$funcName(@units);
my $value = &$funcName(@units);
if (($value ne "NaN" && $value ne "nan") || $self->{_FilterNaN} != 1) {
push @row, $value;
}
}
if ($#row > 0) {
push @{$self->{_SummaryData}}, \@row;
}
push @{$self->{_SummaryData}}, \@row;

}

return 1;
Expand Down
2 changes: 1 addition & 1 deletion configs/config-global-dhp__pagealloc-performance
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export PAGEALLOC_ORDER_MIN=0
export PAGEALLOC_ORDER_MAX=4

# Page Fault Test (PFT)
export PFT_ITERATIONS=20
export PFT_ITERATIONS=80
export PFT_MAPPING_SIZE=$((MEMTOTAL_BYTES/5))
export PFT_MAX_CLIENTS=$NUMCPUS
export PFT_USE_PROCESSES=yes
Expand Down
2 changes: 1 addition & 1 deletion vmr/bin/bench-stream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ "$STREAM_ITERATIONS" != "" ]; then
else
INSTANCES=10
fi
MINIMUM_POWER=17
MINIMUM_POWER=21
LARGEST_POWER=29
INCREMENT=3
HUGECTL=
Expand Down

0 comments on commit d3a21cc

Please sign in to comment.