70 lines
2.2 KiB
Perl
70 lines
2.2 KiB
Perl
package TraceWeight;
|
|
|
|
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 is there?
|
|
# It queries the same "SUM(t.time2 - t.time1 + 1)" as ResultsData.pm,
|
|
# but doesn't join over "result_GenericExperimentMessage", so the
|
|
# faultspace area is not repeated.
|
|
# The "COUNT(*)" part counts the number of equivalence classes
|
|
# (or the number of pilots in other words).
|
|
#
|
|
# We run with --inject-single-bit, so FAIL* produces one result
|
|
# per bit (8 * p.data_width).
|
|
# This means "area" matches the ResultsData.pm query and
|
|
# can be used as a denominator (to calculate marker percentages
|
|
# that work better between different execution modes, as we don't
|
|
# want to compare a variable that is "live" for 100 ticks to one
|
|
# that is "live" for 5):
|
|
# - area == SUM(resultsdata.faults) over all resulttypes
|
|
#
|
|
# In the IP benchmark every equivalence class is one tick long and
|
|
# one byte wide, so we expect the following relations:
|
|
# - weight == pilots == instruction count
|
|
# - area == injections == 8 * pilots
|
|
my $querystring = "SELECT
|
|
benchmark,
|
|
SUM(t.time2 - t.time1 + 1) AS weight,
|
|
SUM((t.time2 - t.time1 + 1) * p.data_width) * 8 AS area,
|
|
SUM(p.data_width) * 8 AS injections,
|
|
COUNT(*) AS pilots
|
|
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 fsppilot p ON p.id = g.pilot_id
|
|
WHERE t.accesstype = 'R' AND v.variant = '$experiment'$extra
|
|
GROUP BY v.id, benchmark
|
|
ORDER BY variant, benchmark;";
|
|
|
|
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 "traceweight${suffix}.csv";
|
|
}
|
|
|
|
sub postprocess { $_[0] =~ s/\t/,/g; }
|
|
|
|
1;
|