105 lines
3.5 KiB
Perl
105 lines
3.5 KiB
Perl
package ResultsDataWriteGroups;
|
|
|
|
use strict;
|
|
use warnings;
|
|
use diagnostics;
|
|
|
|
use FindBin;
|
|
use lib "$FindBin::Bin/../Modules";
|
|
use Filters;
|
|
|
|
use feature 'say';
|
|
|
|
sub query {
|
|
my ( $experiment, $experiment_dir, @filter_config_names ) = @_;
|
|
|
|
my $extra =
|
|
Filters::build_filter_clause( $experiment_dir, @filter_config_names );
|
|
|
|
# Filters are applied per column because of the disjunct branch union
|
|
my $data_extra =
|
|
Filters::build_filter_clause_restricted( $experiment_dir, qr/^g\./,
|
|
@filter_config_names );
|
|
my $instr_extra =
|
|
Filters::build_filter_clause_restricted( $experiment_dir, qr/^p\./,
|
|
@filter_config_names );
|
|
$instr_extra =~ s/\bp\.injection_instr_absolute\b/g.instr2_absolute/g;
|
|
|
|
# This is the same as ResultsData.pm (how much faultspace
|
|
# area ended up in each possible outcome), but includes the
|
|
# "inject-on-write" fault model like in global-occurrences-onwrite.sh
|
|
#
|
|
# A fault in a written value is treated as a fault in the next access to
|
|
# the same address. Only a read consumes the value, if it is overwritten
|
|
# first, the write is skipped.
|
|
#
|
|
# FAIL weights the write area by SUM(t.width), this query uses
|
|
# (g.time2 - g.time1 + 1) instead.
|
|
my $resulttype_order =
|
|
"FIELD(resulttype, 'OK_MARKER', 'FAIL_MARKER', 'DETECTED_MARKER',"
|
|
. " 'GROUP1_MARKER', 'GROUP2_MARKER', 'GROUP3_MARKER', 'GROUP4_MARKER',"
|
|
. " 'TIMEOUT', 'TRAP', 'WRITE_TEXTSEGMENT', 'ACCESS_OUTERSPACE',"
|
|
. " 'SDC', 'UNKNOWN')";
|
|
|
|
my $querystring = "SELECT
|
|
benchmark, resulttype, SUM(faults) AS faults
|
|
FROM (
|
|
SELECT v.benchmark AS benchmark, rc.resulttype AS resulttype, SUM(cl.len * rc.cnt) AS faults
|
|
FROM variant v
|
|
JOIN (
|
|
SELECT g.variant_id, p.id AS pilot_id, SUM(g.time2 - g.time1 + 1) AS len
|
|
FROM trace g
|
|
JOIN fsppilot p ON p.variant_id = g.variant_id
|
|
AND p.known_outcome = 0
|
|
AND p.instr2 = g.instr2
|
|
AND p.data_physical_address = g.data_physical_address
|
|
WHERE 1 = 1$extra
|
|
GROUP BY g.variant_id, p.id
|
|
) cl ON cl.variant_id = v.id
|
|
JOIN (
|
|
SELECT r.pilot_id, r.resulttype, COUNT(*) AS cnt
|
|
FROM result_GenericExperimentMessage r
|
|
GROUP BY r.pilot_id, r.resulttype
|
|
) rc ON rc.pilot_id = cl.pilot_id
|
|
WHERE v.variant = '$experiment'
|
|
GROUP BY v.id, rc.resulttype
|
|
|
|
UNION ALL
|
|
|
|
SELECT v.benchmark AS benchmark, r.resulttype AS resulttype,
|
|
SUM(g.time2 - g.time1 + 1) AS faults
|
|
FROM trace g
|
|
JOIN variant v ON v.id = g.variant_id
|
|
JOIN trace t ON t.variant_id = g.variant_id
|
|
AND t.data_physical_address = g.data_physical_address
|
|
AND t.instr1 = g.instr2 + 1
|
|
AND t.accesstype = 'R'
|
|
JOIN fspgroup h ON h.variant_id = t.variant_id
|
|
AND h.data_physical_address = t.data_physical_address
|
|
AND h.instr2 = t.instr2
|
|
AND h.fspmethod_id = (SELECT id FROM fspmethod WHERE method = 'basic')
|
|
JOIN result_GenericExperimentMessage r ON r.pilot_id = h.pilot_id
|
|
WHERE g.accesstype = 'W'
|
|
AND v.variant = '$experiment'$data_extra$instr_extra
|
|
) x
|
|
GROUP BY benchmark, resulttype
|
|
ORDER BY benchmark, $resulttype_order;";
|
|
|
|
say $querystring;
|
|
|
|
return $querystring;
|
|
}
|
|
|
|
sub args { return "--batch --raw"; }
|
|
|
|
sub filename {
|
|
my @filter_config_names = grep { defined && length } @_;
|
|
my $suffix =
|
|
@filter_config_names ? "_" . join( "+", sort @filter_config_names ) : "";
|
|
return "resultsdata_writegroups${suffix}.csv";
|
|
}
|
|
|
|
sub postprocess { $_[0] =~ s/\t/,/g; }
|
|
|
|
1;
|