Files
failnix/scripts/Queries/ResultsData.pm
T

62 lines
2.0 KiB
Perl

package ResultsData;
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 );
# This query basically asks: How much faultspace area
# ended up in each possible outcome?
# The "SUM(t.time2 - t.time1 + 1)" part combined with the
# "JOIN result_GenericExperimentMessage" part repeats each
# equivalence class for each injection, so the faultspace area
# is "equivalence interval" in ticks (t.time2 - t.time1 + 1) times
# the number of injected bits.
# For a single byte pilot (e.g., uint8 variable), the faultspace area
# would be inflated by x8 (8 possible bits to inject).
#
# This is the inject-on-read model: only reads are injected (write
# faults are covered by equivalence, because a write fault only
# materializes if the value is read afterwards), so the write rows in
# the trace (and the single write row in fspgroup that BasicPruner.cc
# inserts) are excluded.
my $querystring = "SELECT
benchmark, resulttype, SUM(t.time2 - t.time1 + 1) AS faults
FROM variant v
JOIN trace t ON v.id = t.variant_id
JOIN fspgroup g ON g.variant_id = t.variant_id AND g.instr2 = t.instr2 AND g.data_physical_address = t.data_physical_address
JOIN result_GenericExperimentMessage r ON r.pilot_id = g.pilot_id
JOIN fsppilot p ON r.pilot_id = p.id
WHERE t.accesstype = 'R' AND v.variant = '$experiment'$extra
GROUP BY v.id, resulttype
ORDER BY variant, benchmark, resulttype;";
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${suffix}.csv";
}
sub postprocess { $_[0] =~ s/\t/,/g; }
1;