Align ResultsDataWriteGroups query with global-occurrences-onwrite.sh

This commit is contained in:
2026-09-19 11:43:19 +02:00
parent 3d25b439ce
commit f11b025b77
+21 -27
View File
@@ -16,27 +16,23 @@ sub query {
my $extra = my $extra =
Filters::build_filter_clause( $experiment_dir, @filter_config_names ); Filters::build_filter_clause( $experiment_dir, @filter_config_names );
# The write branch applies the data filters on the trace and the # Filters are applied per column because of the disjunct branch union
# instruction filters on the pilot, so the clause is built per column.
my $data_extra = my $data_extra =
Filters::build_filter_clause_restricted( $experiment_dir, qr/^g\./, Filters::build_filter_clause_restricted( $experiment_dir, qr/^g\./,
@filter_config_names ); @filter_config_names );
my $instr_extra = my $instr_extra =
Filters::build_filter_clause_restricted( $experiment_dir, qr/^p\./, Filters::build_filter_clause_restricted( $experiment_dir, qr/^p\./,
@filter_config_names ); @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 # This is the same as ResultsData.pm (how much faultspace
# area ended up in each possible outcome), but applies the # area ended up in each possible outcome), but includes the
# possible writegroups fix. # "inject-on-write" fault model like in global-occurrences-onwrite.sh
# #
# At first I have written this query similar to ResultsData.pm, with # A fault in a written value is treated as a fault in the next access to
# an inner join to reconstruct the "fixed" fspgroup table within the query. # the same address.
# This was extremely slow since it resulted in a large cross product # FAIL weights the write area by SUM(t.width), this query uses
# between the write groups/classes and the write pilots injections # (g.time2 - g.time1 + 1) instead.
# (also I don't think the indices were helping the way I wrote the query).
#
# This version now constructs the result in two
# disjunct branches (as the data is disjunct in known_outcome = 0/1).
my $resulttype_order = my $resulttype_order =
"FIELD(resulttype, 'OK_MARKER', 'FAIL_MARKER', 'DETECTED_MARKER'," "FIELD(resulttype, 'OK_MARKER', 'FAIL_MARKER', 'DETECTED_MARKER',"
. " 'GROUP1_MARKER', 'GROUP2_MARKER', 'GROUP3_MARKER', 'GROUP4_MARKER'," . " 'GROUP1_MARKER', 'GROUP2_MARKER', 'GROUP3_MARKER', 'GROUP4_MARKER',"
@@ -68,22 +64,20 @@ FROM (
UNION ALL UNION ALL
SELECT v.benchmark AS benchmark, rc.resulttype AS resulttype, wl.len * rc.cnt AS faults SELECT v.benchmark AS benchmark, r.resulttype AS resulttype,
FROM variant v SUM(g.time2 - g.time1 + 1) AS faults
JOIN (
SELECT g.variant_id, SUM(g.time2 - g.time1 + 1) AS len
FROM trace g FROM trace g
WHERE g.accesstype = 'W'$data_extra JOIN variant v ON v.id = g.variant_id
GROUP BY g.variant_id JOIN trace t ON t.variant_id = g.variant_id
) wl ON wl.variant_id = v.id AND t.data_physical_address = g.data_physical_address
JOIN ( AND t.instr1 = g.instr2 + 1
SELECT p.variant_id, r.resulttype, COUNT(*) AS cnt JOIN fspgroup h ON h.variant_id = t.variant_id
FROM fsppilot p AND h.data_physical_address = t.data_physical_address
JOIN result_GenericExperimentMessage r ON r.pilot_id = p.id AND h.instr2 = t.instr2
WHERE p.known_outcome = 1$instr_extra AND h.fspmethod_id = (SELECT id FROM fspmethod WHERE method = 'basic')
GROUP BY p.variant_id, r.resulttype JOIN result_GenericExperimentMessage r ON r.pilot_id = h.pilot_id
) rc ON rc.variant_id = v.id WHERE g.accesstype = 'W'
WHERE v.variant = '$experiment' AND v.variant = '$experiment'$data_extra$instr_extra
) x ) x
GROUP BY benchmark, resulttype GROUP BY benchmark, resulttype
ORDER BY benchmark, $resulttype_order;"; ORDER BY benchmark, $resulttype_order;";