-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mel Gorman <mgorman@suse.de>
- Loading branch information
Mel Gorman
committed
Nov 3, 2014
1 parent
86ecd9d
commit d3a21cc
Showing
5 changed files
with
76 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters