Add traceweight query

This commit is contained in:
2026-08-17 21:50:36 +02:00
parent d243703704
commit 87d5d5b92d
43 changed files with 181 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
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).
# The number of actual injections is (probably/hopefully) 8 * pilots,
# because we run with --inject-single-bit.
# We expect the "weight" to be equal to the number of pilots for the
# IP benchmark, as the IP injections are only a single tick long.
my $querystring = "SELECT
benchmark, SUM(t.time2 - t.time1 + 1) AS weight, 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 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;