hfim-cli 1.15.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fim/__init__.py +42 -0
- fim/analysis/__init__.py +53 -0
- fim/analysis/burst_sdc.py +160 -0
- fim/analysis/classifier.py +924 -0
- fim/analysis/comparator.py +738 -0
- fim/analysis/consolidate.py +625 -0
- fim/analysis/csv_io.py +28 -0
- fim/analysis/ecc_quartet.py +167 -0
- fim/analysis/nvm_endurance_matrix.py +170 -0
- fim/analysis/observable_state.py +945 -0
- fim/analysis/reporter.py +712 -0
- fim/analysis/results_txt.py +229 -0
- fim/campaigns/__init__.py +28 -0
- fim/campaigns/base_campaign.py +5151 -0
- fim/campaigns/cache_campaign.py +233 -0
- fim/campaigns/campaign_view.py +135 -0
- fim/campaigns/csr_campaign.py +31 -0
- fim/campaigns/fault_plan.py +105 -0
- fim/campaigns/faultlist_builder.py +503 -0
- fim/campaigns/gem5_parallel_runner.py +210 -0
- fim/campaigns/golden_gate.py +158 -0
- fim/campaigns/injection_point_selector.py +473 -0
- fim/campaigns/memory_campaign.py +686 -0
- fim/campaigns/parallel_runner.py +510 -0
- fim/campaigns/register_campaign.py +617 -0
- fim/campaigns/serial_feeder.py +169 -0
- fim/cli.py +2652 -0
- fim/configs/benchmarks/bitcount.yaml +11 -0
- fim/configs/benchmarks/checksum.yaml +11 -0
- fim/configs/benchmarks/dotprod_f64.yaml +12 -0
- fim/configs/benchmarks/fibonacci.yaml +10 -0
- fim/configs/boards/board_spec_schema.yaml +216 -0
- fim/configs/boards/raspberry_pi_5.yaml +122 -0
- fim/configs/boards/xuantie_c906.yaml +127 -0
- fim/configs/boards/xuantie_c906_ruby_nvmain.yaml +85 -0
- fim/configs/dramsim3/DDR3_1Gb_x8_1333.ini +69 -0
- fim/configs/dramsim3/DDR3_4Gb_x16_1600.ini +67 -0
- fim/configs/dramsim3/DDR3_4Gb_x16_1866.ini +67 -0
- fim/configs/dramsim3/DDR3_4Gb_x4_1600.ini +67 -0
- fim/configs/dramsim3/DDR3_4Gb_x4_1866.ini +67 -0
- fim/configs/dramsim3/DDR3_4Gb_x8_1600.ini +67 -0
- fim/configs/dramsim3/DDR3_4Gb_x8_1866.ini +67 -0
- fim/configs/dramsim3/DDR3_8Gb_x16_1600.ini +67 -0
- fim/configs/dramsim3/DDR3_8Gb_x16_1866.ini +67 -0
- fim/configs/dramsim3/DDR3_8Gb_x4_1600.ini +67 -0
- fim/configs/dramsim3/DDR3_8Gb_x4_1866.ini +67 -0
- fim/configs/dramsim3/DDR3_8Gb_x8_1600.ini +67 -0
- fim/configs/dramsim3/DDR3_8Gb_x8_1866.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x16_1866.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x16_2133.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x16_2133_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x16_2400.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x16_2400_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x16_2666.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x16_2666_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x4_1866.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x4_2133.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x4_2133_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x4_2400.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x4_2400_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x4_2666.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x4_2666_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x8_1866.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x8_2133.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x8_2133_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x8_2400.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x8_2400_2.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x8_2666.ini +67 -0
- fim/configs/dramsim3/DDR4_4Gb_x8_2666_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_1866.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2133.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2133_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2400.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2400_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2666.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2666_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2933.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_2933_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x16_3200.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_1866.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2133.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2133_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2400.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2400_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2666.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2666_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2933.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_2933_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x4_3200.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_1866.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2133.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2133_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2400.ini +77 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2400_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2666.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2666_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2933.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_2933_2.ini +67 -0
- fim/configs/dramsim3/DDR4_8Gb_x8_3200.ini +67 -0
- fim/configs/ecc_policies/c906.yaml +26 -0
- fim/configs/matmul_aarch64.yaml +62 -0
- fim/configs/mcpat/c906.xml +481 -0
- fim/configs/mcpat/raspberry_pi_5.xml +405 -0
- fim/configs/mcpat/sTemplate.xml +444 -0
- fim/configs/mcpat/template.xml +405 -0
- fim/configs/mmult.yaml +140 -0
- fim/configs/mmult_memory_gem5.yaml +23 -0
- fim/configs/nvmain/2D_DRAM_example.config +249 -0
- fim/configs/nvmain/3D_DRAMCache_OffChipMemory_example.config +154 -0
- fim/configs/nvmain/3D_DRAMCache_example.config +275 -0
- fim/configs/nvmain/3D_DRAM_example.config +237 -0
- fim/configs/nvmain/3D_PredictorDRC_example.config +277 -0
- fim/configs/nvmain/3D_VariableDRC_example.config +278 -0
- fim/configs/nvmain/Hybrid_DRAM_channel.config +249 -0
- fim/configs/nvmain/Hybrid_NVM_channel.config +208 -0
- fim/configs/nvmain/Hybrid_NVM_channel_BitModel.config +208 -0
- fim/configs/nvmain/Hybrid_example.config +72 -0
- fim/configs/nvmain/Hybrid_example_BitModel.config +72 -0
- fim/configs/nvmain/PCM_ISSCC_2012_4GB.config +217 -0
- fim/configs/nvmain/PCM_ISSCC_2012_4GB_BitModel.config +217 -0
- fim/configs/nvmain/PCM_ISSCC_2012_4GB_BitModel_ECP.config +222 -0
- fim/configs/nvmain/PCM_ISSCC_2012_4GB_ByteModel.config +217 -0
- fim/configs/nvmain/PCM_ISSCC_2012_4GB_RowModel.config +217 -0
- fim/configs/nvmain/PCM_ISSCC_2012_4GB_WordModel.config +217 -0
- fim/configs/nvmain/PCM_MLC_estimated.config +233 -0
- fim/configs/nvmain/PCM_MLC_example.config +232 -0
- fim/configs/nvmain/PCM_MLC_example_BitModel.config +232 -0
- fim/configs/nvmain/PerfectMemory.config +229 -0
- fim/configs/nvmain/RRAM_ISSCC_2012_4GB.config +218 -0
- fim/configs/nvmain/STTRAM_Everspin_4GB.config +217 -0
- fim/configs/nvmain/STTRAM_Everspin_4GB_BitModel.config +217 -0
- fim/configs/nvmain/printtrace.config +145 -0
- fim/configs/nvmain/printtrace_bitflip.config +146 -0
- fim/configs/quicksort_dmr.yaml +225 -0
- fim/configs/rust_sort_array.yaml +28 -0
- fim/configs/rust_sort_bss.yaml +38 -0
- fim/configs/sum.yaml +149 -0
- fim/configs/template.yaml +418 -0
- fim/configs/toolchains.remote.json +14 -0
- fim/core/__init__.py +161 -0
- fim/core/artifacts/__init__.py +25 -0
- fim/core/artifacts/adapters/__init__.py +146 -0
- fim/core/artifacts/adapters/board.py +38 -0
- fim/core/artifacts/adapters/config.py +115 -0
- fim/core/artifacts/adapters/sdk.py +435 -0
- fim/core/artifacts/adapters/simulator.py +139 -0
- fim/core/artifacts/adapters/template.py +107 -0
- fim/core/artifacts/classification.py +95 -0
- fim/core/artifacts/hashing.py +265 -0
- fim/core/artifacts/inputs.py +179 -0
- fim/core/artifacts/records.py +238 -0
- fim/core/artifacts/retention.py +504 -0
- fim/core/artifacts/staleness.py +486 -0
- fim/core/artifacts/store.py +202 -0
- fim/core/artifacts/workspace.py +108 -0
- fim/core/checkpoint.py +338 -0
- fim/core/checkpoint_policy.py +171 -0
- fim/core/classifier_view.py +96 -0
- fim/core/clock_view.py +99 -0
- fim/core/configuration/__init__.py +13 -0
- fim/core/configuration/frozen.py +85 -0
- fim/core/configuration/groups.py +41 -0
- fim/core/configuration/includes.py +249 -0
- fim/core/configuration/lifecycle_rules.py +83 -0
- fim/core/configuration/reference.py +200 -0
- fim/core/configuration/reference_docs.py +344 -0
- fim/core/configuration/resolver.py +495 -0
- fim/core/configuration/run_context.py +51 -0
- fim/core/configuration/schema.py +784 -0
- fim/core/configuration/sources.py +121 -0
- fim/core/configuration/template_pins.py +79 -0
- fim/core/fault_models.py +261 -0
- fim/core/fim.py +452 -0
- fim/core/gdb_controller.py +2053 -0
- fim/core/gem5_controller.py +1226 -0
- fim/core/gem5_launch.py +489 -0
- fim/core/gem5_observable.py +202 -0
- fim/core/gem5_producers.py +684 -0
- fim/core/gem5_simulator.py +724 -0
- fim/core/golden_view.py +94 -0
- fim/core/hardware_cluster.py +236 -0
- fim/core/hardware_simulator.py +992 -0
- fim/core/hardware_spec.py +352 -0
- fim/core/hardware_station.py +374 -0
- fim/core/hardware_view.py +64 -0
- fim/core/hardware_window.py +102 -0
- fim/core/hook_view.py +52 -0
- fim/core/lifecycle.py +433 -0
- fim/core/machine_binding.py +317 -0
- fim/core/ovp_plan.py +419 -0
- fim/core/ovp_protocol.py +647 -0
- fim/core/ovp_simulator.py +1201 -0
- fim/core/ovp_view.py +99 -0
- fim/core/qemu_controller.py +1396 -0
- fim/core/qemu_launch.py +179 -0
- fim/core/qemu_simulator.py +329 -0
- fim/core/results_store.py +218 -0
- fim/core/results_view.py +94 -0
- fim/core/simulator_controller.py +298 -0
- fim/core/simulator_manifest.py +739 -0
- fim/core/station_host.py +277 -0
- fim/install/__init__.py +16 -0
- fim/install/ensure.py +182 -0
- fim/install/home.py +126 -0
- fim/install/index.py +122 -0
- fim/install/index.yaml +59 -0
- fim/install/prebuilt.py +120 -0
- fim/install/probes.py +182 -0
- fim/install/remote.py +165 -0
- fim/install/sdk.py +178 -0
- fim/install/setup.py +184 -0
- fim/install/simulators.py +323 -0
- fim/install/template.py +147 -0
- fim/install/uninstall.py +149 -0
- fim/provision/__init__.py +48 -0
- fim/provision/catalog.py +278 -0
- fim/provision/commands.py +1051 -0
- fim/provision/doctor.py +291 -0
- fim/provision/drain.py +117 -0
- fim/provision/forms/__init__.py +4 -0
- fim/provision/forms/docker.py +469 -0
- fim/provision/forms/fake.py +281 -0
- fim/provision/forms/native.py +438 -0
- fim/provision/fresh_layout.py +66 -0
- fim/provision/hostdeps.py +229 -0
- fim/provision/layout_units.py +148 -0
- fim/provision/lock.py +100 -0
- fim/provision/package.py +110 -0
- fim/provision/plan.py +356 -0
- fim/provision/privilege.py +259 -0
- fim/provision/probe.py +117 -0
- fim/provision/release.py +188 -0
- fim/provision/sdk.py +102 -0
- fim/provision/steps.py +324 -0
- fim/provision/switch.py +80 -0
- fim/provision/switch_recovery.py +165 -0
- fim/remote/__init__.py +15 -0
- fim/remote/access/__init__.py +203 -0
- fim/remote/access/credential.py +46 -0
- fim/remote/access/credentials/__init__.py +4 -0
- fim/remote/access/credentials/command.py +50 -0
- fim/remote/access/credentials/keychain.py +50 -0
- fim/remote/access/credentials/none.py +16 -0
- fim/remote/access/credentials/peer.py +25 -0
- fim/remote/access/credentials/token.py +50 -0
- fim/remote/access/spec.py +34 -0
- fim/remote/access/transport.py +66 -0
- fim/remote/access/transports/__init__.py +4 -0
- fim/remote/access/transports/command.py +222 -0
- fim/remote/access/transports/direct.py +39 -0
- fim/remote/access/transports/ssh_tunnel.py +74 -0
- fim/remote/api.py +245 -0
- fim/remote/commands.py +625 -0
- fim/remote/fetch.py +155 -0
- fim/remote/follow.py +157 -0
- fim/remote/journal.py +150 -0
- fim/remote/location.py +108 -0
- fim/remote/preflight.py +350 -0
- fim/remote/servers.py +159 -0
- fim/remote/snapshot.py +249 -0
- fim/remote/submit.py +302 -0
- fim/scripts/__init__.py +2 -0
- fim/scripts/generate_report.py +108 -0
- fim/scripts/run_campaign.py +1447 -0
- fim/scripts/run_ecc_quartet.py +94 -0
- fim/scripts/run_golden.py +2256 -0
- fim/scripts/verify_provenance.py +61 -0
- fim/utils/__init__.py +74 -0
- fim/utils/board.py +378 -0
- fim/utils/board_view.py +39 -0
- fim/utils/config.py +1714 -0
- fim/utils/coredump.py +28 -0
- fim/utils/elf_parser.py +1118 -0
- fim/utils/elf_provenance.py +140 -0
- fim/utils/injection_file_writer.py +309 -0
- fim/utils/logger.py +362 -0
- fim/utils/picker.py +195 -0
- fim/utils/prng.py +207 -0
- fim/utils/provenance.py +873 -0
- fim/utils/register_width.py +52 -0
- hfim_cli-1.15.6.data/data/share/hfim/gem5_to_mcpat.py +508 -0
- hfim_cli-1.15.6.dist-info/METADATA +131 -0
- hfim_cli-1.15.6.dist-info/RECORD +288 -0
- hfim_cli-1.15.6.dist-info/WHEEL +5 -0
- hfim_cli-1.15.6.dist-info/entry_points.txt +2 -0
- hfim_cli-1.15.6.dist-info/licenses/LICENSE +21 -0
- hfim_cli-1.15.6.dist-info/licenses/THIRD_PARTY_NOTICES +166 -0
- hfim_cli-1.15.6.dist-info/top_level.txt +1 -0
fim/analysis/reporter.py
ADDED
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 HI-REST and the HFIM contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Results Reporter for FIM campaigns.
|
|
6
|
+
|
|
7
|
+
This module generates human-readable HTML reports from fault injection campaign
|
|
8
|
+
results. It uses Jinja2 templates for flexible report generation with
|
|
9
|
+
visualization of outcome distributions and detailed statistics.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import csv
|
|
13
|
+
import json
|
|
14
|
+
import os
|
|
15
|
+
|
|
16
|
+
from fim.analysis.classifier import REPORT_OUTCOME_ORDER
|
|
17
|
+
from datetime import datetime
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import Dict, List, Any, Optional
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
from jinja2 import Template, Environment, BaseLoader
|
|
23
|
+
except ImportError:
|
|
24
|
+
raise ImportError(
|
|
25
|
+
"jinja2 is required for report generation. "
|
|
26
|
+
"Install with: pip install jinja2"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
from fim.utils.logger import get_logger
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Constants
|
|
33
|
+
DEFAULT_RESULTS_DIR = "results"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ReporterError(Exception):
|
|
37
|
+
"""Exception raised during report generation."""
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class CampaignReporter:
|
|
42
|
+
"""
|
|
43
|
+
Generates HTML reports from fault injection campaign results.
|
|
44
|
+
|
|
45
|
+
The reporter loads campaign results from CSV and metadata JSON files,
|
|
46
|
+
calculates statistics, and generates an HTML report with outcome
|
|
47
|
+
visualization and detailed analysis.
|
|
48
|
+
|
|
49
|
+
Attributes:
|
|
50
|
+
campaign_id: Unique identifier for the campaign.
|
|
51
|
+
results_dir: Directory containing campaign results.
|
|
52
|
+
logger: Logger instance for reporting progress.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
def __init__(self, campaign_id: str, results_dir: str = DEFAULT_RESULTS_DIR):
|
|
56
|
+
"""
|
|
57
|
+
Initialize campaign reporter.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
campaign_id: Campaign identifier (directory name in results/).
|
|
61
|
+
results_dir: Base directory containing results (default: "results").
|
|
62
|
+
|
|
63
|
+
Raises:
|
|
64
|
+
ReporterError: If campaign results directory doesn't exist.
|
|
65
|
+
"""
|
|
66
|
+
self.campaign_id = campaign_id
|
|
67
|
+
self.results_dir = results_dir
|
|
68
|
+
self.campaign_dir = os.path.join(results_dir, campaign_id)
|
|
69
|
+
self.logger = get_logger(f"fim.reporter.{campaign_id}")
|
|
70
|
+
|
|
71
|
+
# Validate campaign directory exists
|
|
72
|
+
if not os.path.exists(self.campaign_dir):
|
|
73
|
+
raise ReporterError(
|
|
74
|
+
f"Campaign results not found: {self.campaign_dir}"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Paths to campaign files
|
|
78
|
+
self.injections_csv = os.path.join(self.campaign_dir, "injections.csv")
|
|
79
|
+
self.metadata_json = os.path.join(self.campaign_dir, "metadata.json")
|
|
80
|
+
self.report_html = os.path.join(self.campaign_dir, "report.html")
|
|
81
|
+
|
|
82
|
+
# Data loaded from files
|
|
83
|
+
self.metadata: Optional[Dict[str, Any]] = None
|
|
84
|
+
self.injections: List[Dict[str, Any]] = []
|
|
85
|
+
self.statistics: Optional[Dict[str, Any]] = None
|
|
86
|
+
|
|
87
|
+
def generate_report(self) -> str:
|
|
88
|
+
"""
|
|
89
|
+
Generate HTML report from campaign results.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Path to generated HTML report file.
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
ReporterError: If report generation fails.
|
|
96
|
+
"""
|
|
97
|
+
self.logger.info("=" * 80)
|
|
98
|
+
self.logger.info(f"GENERATING REPORT FOR CAMPAIGN: {self.campaign_id}")
|
|
99
|
+
self.logger.info("=" * 80)
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
# Load campaign data
|
|
103
|
+
self._load_metadata()
|
|
104
|
+
self._load_injections()
|
|
105
|
+
|
|
106
|
+
# Extract statistics from metadata
|
|
107
|
+
self.statistics = self.metadata.get('statistics', {})
|
|
108
|
+
|
|
109
|
+
# Generate HTML report
|
|
110
|
+
html_content = self._render_html()
|
|
111
|
+
|
|
112
|
+
# Save report to file
|
|
113
|
+
with open(self.report_html, 'w', encoding='utf-8') as f:
|
|
114
|
+
f.write(html_content)
|
|
115
|
+
|
|
116
|
+
self.logger.info(f"Report generated: {self.report_html}")
|
|
117
|
+
self.logger.info("=" * 80)
|
|
118
|
+
|
|
119
|
+
return self.report_html
|
|
120
|
+
|
|
121
|
+
except Exception as e:
|
|
122
|
+
raise ReporterError(f"Failed to generate report: {e}")
|
|
123
|
+
|
|
124
|
+
def _load_metadata(self) -> None:
|
|
125
|
+
"""
|
|
126
|
+
Load campaign metadata from JSON file.
|
|
127
|
+
|
|
128
|
+
Raises:
|
|
129
|
+
ReporterError: If metadata file doesn't exist or is invalid.
|
|
130
|
+
"""
|
|
131
|
+
if not os.path.exists(self.metadata_json):
|
|
132
|
+
raise ReporterError(f"Metadata file not found: {self.metadata_json}")
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
with open(self.metadata_json, 'r') as f:
|
|
136
|
+
self.metadata = json.load(f)
|
|
137
|
+
self.logger.debug(f"Loaded metadata from: {self.metadata_json}")
|
|
138
|
+
except json.JSONDecodeError as e:
|
|
139
|
+
raise ReporterError(f"Invalid JSON in metadata file: {e}")
|
|
140
|
+
except Exception as e:
|
|
141
|
+
raise ReporterError(f"Failed to load metadata: {e}")
|
|
142
|
+
|
|
143
|
+
def _load_injections(self) -> None:
|
|
144
|
+
"""
|
|
145
|
+
Load injection results from CSV file.
|
|
146
|
+
|
|
147
|
+
Raises:
|
|
148
|
+
ReporterError: If CSV file doesn't exist or is invalid.
|
|
149
|
+
"""
|
|
150
|
+
if not os.path.exists(self.injections_csv):
|
|
151
|
+
raise ReporterError(f"Injections CSV not found: {self.injections_csv}")
|
|
152
|
+
|
|
153
|
+
try:
|
|
154
|
+
with open(self.injections_csv, 'r', newline='') as f:
|
|
155
|
+
reader = csv.DictReader(f)
|
|
156
|
+
self.injections = list(reader)
|
|
157
|
+
self.logger.debug(f"Loaded {len(self.injections)} injections from CSV")
|
|
158
|
+
except Exception as e:
|
|
159
|
+
raise ReporterError(f"Failed to load injections CSV: {e}")
|
|
160
|
+
|
|
161
|
+
def _get_top_sdc_injections(self, limit: int = 10) -> List[Dict[str, Any]]:
|
|
162
|
+
"""
|
|
163
|
+
Get top injection points that caused SDC (Silent Data Corruption).
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
limit: Maximum number of injections to return.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
List of injection dictionaries with SDC outcomes.
|
|
170
|
+
"""
|
|
171
|
+
sdc_injections = [
|
|
172
|
+
inj for inj in self.injections
|
|
173
|
+
if inj.get('outcome', '').lower() == 'sdc'
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
# Sort by instruction count (earliest injections first)
|
|
177
|
+
sdc_injections.sort(key=lambda x: int(x.get('instruction_count', 0)))
|
|
178
|
+
|
|
179
|
+
return sdc_injections[:limit]
|
|
180
|
+
|
|
181
|
+
def _get_outcome_data_for_chart(self) -> Dict[str, List]:
|
|
182
|
+
"""
|
|
183
|
+
Prepare outcome data for pie chart visualization.
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
Dictionary with labels, values, and colors for chart (all as lists).
|
|
187
|
+
"""
|
|
188
|
+
# Outcome colors (matching standard severity levels)
|
|
189
|
+
outcome_colors = {
|
|
190
|
+
'masked': '#28a745', # Green - good (fault had no effect)
|
|
191
|
+
'detected': '#ffc107', # Yellow - acceptable (detected by DMR)
|
|
192
|
+
'sdc': '#dc3545', # Red - critical (silent corruption)
|
|
193
|
+
'crash': '#fd7e14', # Orange - serious (system failure)
|
|
194
|
+
'timeout': '#6c757d', # Gray - inconclusive
|
|
195
|
+
'unknown': '#e9ecef', # Light gray - unclassified
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
labels: List[str] = []
|
|
199
|
+
values: List[int] = []
|
|
200
|
+
colors: List[str] = []
|
|
201
|
+
|
|
202
|
+
# Order outcomes by criticality
|
|
203
|
+
outcome_order = list(REPORT_OUTCOME_ORDER)
|
|
204
|
+
|
|
205
|
+
for outcome in outcome_order:
|
|
206
|
+
outcome_stats = self.statistics.get(outcome, {})
|
|
207
|
+
count = outcome_stats.get('count', 0)
|
|
208
|
+
if count > 0: # Only include outcomes that occurred
|
|
209
|
+
labels.append(outcome.upper())
|
|
210
|
+
values.append(count)
|
|
211
|
+
colors.append(outcome_colors.get(outcome, '#6c757d'))
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
'labels': labels,
|
|
215
|
+
'values': values,
|
|
216
|
+
'colors': colors,
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
def _render_html(self) -> str:
|
|
220
|
+
"""
|
|
221
|
+
Render HTML report using Jinja2 template.
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
HTML content as string.
|
|
225
|
+
"""
|
|
226
|
+
template_str = self._get_html_template()
|
|
227
|
+
template = Template(template_str)
|
|
228
|
+
|
|
229
|
+
# Prepare data for template
|
|
230
|
+
chart_data = self._get_outcome_data_for_chart()
|
|
231
|
+
top_sdc = self._get_top_sdc_injections(limit=10)
|
|
232
|
+
|
|
233
|
+
# Calculate derived metrics
|
|
234
|
+
total = self.statistics.get('total', 0)
|
|
235
|
+
dmr_effectiveness = self.statistics.get('dmr_effectiveness', 0.0)
|
|
236
|
+
|
|
237
|
+
# Format timestamps
|
|
238
|
+
report_timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
239
|
+
campaign_completed = self.metadata.get('completed_at', 'Unknown')
|
|
240
|
+
|
|
241
|
+
# Convert statistics to JSON-serializable dict
|
|
242
|
+
# (Sometimes stats contain dict_values objects that aren't JSON serializable)
|
|
243
|
+
stats_dict = {}
|
|
244
|
+
for key, value in self.statistics.items():
|
|
245
|
+
if isinstance(value, dict):
|
|
246
|
+
stats_dict[key] = dict(value)
|
|
247
|
+
else:
|
|
248
|
+
stats_dict[key] = value
|
|
249
|
+
|
|
250
|
+
# Pre-serialize chart data as JSON strings for JavaScript
|
|
251
|
+
import json
|
|
252
|
+
chart_labels_json = json.dumps(chart_data['labels'])
|
|
253
|
+
chart_values_json = json.dumps(chart_data['values'])
|
|
254
|
+
chart_colors_json = json.dumps(chart_data['colors'])
|
|
255
|
+
|
|
256
|
+
# Render template
|
|
257
|
+
html = template.render(
|
|
258
|
+
campaign_id=self.campaign_id,
|
|
259
|
+
benchmark=self.metadata.get('benchmark', 'Unknown'),
|
|
260
|
+
seed=self.metadata.get('seed', 0),
|
|
261
|
+
fault_model=self.metadata.get('fault_model', 'Unknown'),
|
|
262
|
+
total_injections=total,
|
|
263
|
+
detection_string=self.metadata.get('detection_string', 'None'),
|
|
264
|
+
config_path=self.metadata.get('config_path', 'Unknown'),
|
|
265
|
+
target_types=', '.join(self.metadata.get('target_types', [])),
|
|
266
|
+
completed_at=campaign_completed,
|
|
267
|
+
report_timestamp=report_timestamp,
|
|
268
|
+
statistics=stats_dict,
|
|
269
|
+
chart_labels_json=chart_labels_json,
|
|
270
|
+
chart_values_json=chart_values_json,
|
|
271
|
+
chart_colors_json=chart_colors_json,
|
|
272
|
+
top_sdc=top_sdc,
|
|
273
|
+
dmr_effectiveness=dmr_effectiveness,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
return html
|
|
277
|
+
|
|
278
|
+
def _get_html_template(self) -> str:
|
|
279
|
+
"""
|
|
280
|
+
Get HTML template string for report generation.
|
|
281
|
+
|
|
282
|
+
Returns:
|
|
283
|
+
HTML template with Jinja2 placeholders.
|
|
284
|
+
"""
|
|
285
|
+
return """<!DOCTYPE html>
|
|
286
|
+
<html lang="en">
|
|
287
|
+
<head>
|
|
288
|
+
<meta charset="UTF-8">
|
|
289
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
290
|
+
<title>FIM Campaign Report - {{ campaign_id }}</title>
|
|
291
|
+
<style>
|
|
292
|
+
* {
|
|
293
|
+
margin: 0;
|
|
294
|
+
padding: 0;
|
|
295
|
+
box-sizing: border-box;
|
|
296
|
+
}
|
|
297
|
+
body {
|
|
298
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
299
|
+
line-height: 1.6;
|
|
300
|
+
color: #333;
|
|
301
|
+
background: #f5f5f5;
|
|
302
|
+
padding: 20px;
|
|
303
|
+
}
|
|
304
|
+
.container {
|
|
305
|
+
max-width: 1200px;
|
|
306
|
+
margin: 0 auto;
|
|
307
|
+
background: white;
|
|
308
|
+
padding: 30px;
|
|
309
|
+
border-radius: 8px;
|
|
310
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
311
|
+
}
|
|
312
|
+
header {
|
|
313
|
+
border-bottom: 3px solid #007bff;
|
|
314
|
+
padding-bottom: 20px;
|
|
315
|
+
margin-bottom: 30px;
|
|
316
|
+
}
|
|
317
|
+
h1 {
|
|
318
|
+
color: #007bff;
|
|
319
|
+
font-size: 2.5em;
|
|
320
|
+
margin-bottom: 10px;
|
|
321
|
+
}
|
|
322
|
+
h2 {
|
|
323
|
+
color: #495057;
|
|
324
|
+
font-size: 1.8em;
|
|
325
|
+
margin-top: 30px;
|
|
326
|
+
margin-bottom: 15px;
|
|
327
|
+
border-bottom: 2px solid #e9ecef;
|
|
328
|
+
padding-bottom: 10px;
|
|
329
|
+
}
|
|
330
|
+
h3 {
|
|
331
|
+
color: #6c757d;
|
|
332
|
+
font-size: 1.3em;
|
|
333
|
+
margin-top: 20px;
|
|
334
|
+
margin-bottom: 10px;
|
|
335
|
+
}
|
|
336
|
+
.meta-grid {
|
|
337
|
+
display: grid;
|
|
338
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
339
|
+
gap: 15px;
|
|
340
|
+
margin-bottom: 30px;
|
|
341
|
+
}
|
|
342
|
+
.meta-item {
|
|
343
|
+
background: #f8f9fa;
|
|
344
|
+
padding: 15px;
|
|
345
|
+
border-radius: 5px;
|
|
346
|
+
border-left: 4px solid #007bff;
|
|
347
|
+
}
|
|
348
|
+
.meta-label {
|
|
349
|
+
font-weight: bold;
|
|
350
|
+
color: #6c757d;
|
|
351
|
+
font-size: 0.9em;
|
|
352
|
+
text-transform: uppercase;
|
|
353
|
+
margin-bottom: 5px;
|
|
354
|
+
}
|
|
355
|
+
.meta-value {
|
|
356
|
+
color: #212529;
|
|
357
|
+
font-size: 1.1em;
|
|
358
|
+
}
|
|
359
|
+
.stats-grid {
|
|
360
|
+
display: grid;
|
|
361
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
362
|
+
gap: 15px;
|
|
363
|
+
margin-bottom: 30px;
|
|
364
|
+
}
|
|
365
|
+
.stat-card {
|
|
366
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
367
|
+
color: white;
|
|
368
|
+
padding: 20px;
|
|
369
|
+
border-radius: 8px;
|
|
370
|
+
text-align: center;
|
|
371
|
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
|
372
|
+
}
|
|
373
|
+
.stat-card.masked { background: linear-gradient(135deg, #28a745 0%, #20c997 100%); }
|
|
374
|
+
.stat-card.detected { background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%); }
|
|
375
|
+
.stat-card.sdc { background: linear-gradient(135deg, #dc3545 0%, #c82333 100%); }
|
|
376
|
+
.stat-card.crash { background: linear-gradient(135deg, #fd7e14 0%, #e83e8c 100%); }
|
|
377
|
+
.stat-card.timeout { background: linear-gradient(135deg, #6c757d 0%, #495057 100%); }
|
|
378
|
+
.stat-value {
|
|
379
|
+
font-size: 2.5em;
|
|
380
|
+
font-weight: bold;
|
|
381
|
+
margin-bottom: 5px;
|
|
382
|
+
}
|
|
383
|
+
.stat-label {
|
|
384
|
+
font-size: 0.9em;
|
|
385
|
+
opacity: 0.9;
|
|
386
|
+
text-transform: uppercase;
|
|
387
|
+
}
|
|
388
|
+
.stat-percentage {
|
|
389
|
+
font-size: 1.1em;
|
|
390
|
+
margin-top: 5px;
|
|
391
|
+
}
|
|
392
|
+
.chart-container {
|
|
393
|
+
margin: 30px 0;
|
|
394
|
+
text-align: center;
|
|
395
|
+
}
|
|
396
|
+
.chart-wrapper {
|
|
397
|
+
display: inline-block;
|
|
398
|
+
max-width: 600px;
|
|
399
|
+
width: 100%;
|
|
400
|
+
}
|
|
401
|
+
canvas {
|
|
402
|
+
max-width: 100%;
|
|
403
|
+
height: auto;
|
|
404
|
+
}
|
|
405
|
+
table {
|
|
406
|
+
width: 100%;
|
|
407
|
+
border-collapse: collapse;
|
|
408
|
+
margin-top: 15px;
|
|
409
|
+
font-size: 0.9em;
|
|
410
|
+
}
|
|
411
|
+
th, td {
|
|
412
|
+
text-align: left;
|
|
413
|
+
padding: 12px;
|
|
414
|
+
border-bottom: 1px solid #dee2e6;
|
|
415
|
+
}
|
|
416
|
+
th {
|
|
417
|
+
background: #f8f9fa;
|
|
418
|
+
font-weight: bold;
|
|
419
|
+
color: #495057;
|
|
420
|
+
text-transform: uppercase;
|
|
421
|
+
font-size: 0.85em;
|
|
422
|
+
}
|
|
423
|
+
tr:hover {
|
|
424
|
+
background: #f8f9fa;
|
|
425
|
+
}
|
|
426
|
+
.outcome-badge {
|
|
427
|
+
display: inline-block;
|
|
428
|
+
padding: 4px 8px;
|
|
429
|
+
border-radius: 3px;
|
|
430
|
+
font-size: 0.85em;
|
|
431
|
+
font-weight: bold;
|
|
432
|
+
text-transform: uppercase;
|
|
433
|
+
}
|
|
434
|
+
.outcome-sdc { background: #dc3545; color: white; }
|
|
435
|
+
.outcome-crash { background: #fd7e14; color: white; }
|
|
436
|
+
.outcome-detected { background: #ffc107; color: #212529; }
|
|
437
|
+
.outcome-masked { background: #28a745; color: white; }
|
|
438
|
+
.outcome-timeout { background: #6c757d; color: white; }
|
|
439
|
+
.dmr-effectiveness {
|
|
440
|
+
background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
|
|
441
|
+
color: white;
|
|
442
|
+
padding: 25px;
|
|
443
|
+
border-radius: 8px;
|
|
444
|
+
text-align: center;
|
|
445
|
+
margin: 20px 0;
|
|
446
|
+
}
|
|
447
|
+
.dmr-value {
|
|
448
|
+
font-size: 3em;
|
|
449
|
+
font-weight: bold;
|
|
450
|
+
}
|
|
451
|
+
.dmr-label {
|
|
452
|
+
font-size: 1.2em;
|
|
453
|
+
margin-top: 10px;
|
|
454
|
+
}
|
|
455
|
+
.no-data {
|
|
456
|
+
text-align: center;
|
|
457
|
+
color: #6c757d;
|
|
458
|
+
padding: 40px;
|
|
459
|
+
background: #f8f9fa;
|
|
460
|
+
border-radius: 5px;
|
|
461
|
+
}
|
|
462
|
+
footer {
|
|
463
|
+
margin-top: 50px;
|
|
464
|
+
padding-top: 20px;
|
|
465
|
+
border-top: 2px solid #e9ecef;
|
|
466
|
+
text-align: center;
|
|
467
|
+
color: #6c757d;
|
|
468
|
+
font-size: 0.9em;
|
|
469
|
+
}
|
|
470
|
+
.code {
|
|
471
|
+
font-family: 'Courier New', monospace;
|
|
472
|
+
background: #f8f9fa;
|
|
473
|
+
padding: 2px 6px;
|
|
474
|
+
border-radius: 3px;
|
|
475
|
+
font-size: 0.9em;
|
|
476
|
+
}
|
|
477
|
+
</style>
|
|
478
|
+
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
|
|
479
|
+
</head>
|
|
480
|
+
<body>
|
|
481
|
+
<div class="container">
|
|
482
|
+
<header>
|
|
483
|
+
<h1>Fault Injection Campaign Report</h1>
|
|
484
|
+
<p style="color: #6c757d; font-size: 1.1em; margin-top: 10px;">
|
|
485
|
+
Campaign ID: <span class="code">{{ campaign_id }}</span>
|
|
486
|
+
</p>
|
|
487
|
+
</header>
|
|
488
|
+
|
|
489
|
+
<section>
|
|
490
|
+
<h2>Campaign Configuration</h2>
|
|
491
|
+
<div class="meta-grid">
|
|
492
|
+
<div class="meta-item">
|
|
493
|
+
<div class="meta-label">Benchmark</div>
|
|
494
|
+
<div class="meta-value">{{ benchmark }}</div>
|
|
495
|
+
</div>
|
|
496
|
+
<div class="meta-item">
|
|
497
|
+
<div class="meta-label">Fault Model</div>
|
|
498
|
+
<div class="meta-value">{{ fault_model }}</div>
|
|
499
|
+
</div>
|
|
500
|
+
<div class="meta-item">
|
|
501
|
+
<div class="meta-label">PRNG Seed</div>
|
|
502
|
+
<div class="meta-value">{{ seed }}</div>
|
|
503
|
+
</div>
|
|
504
|
+
<div class="meta-item">
|
|
505
|
+
<div class="meta-label">Total Injections</div>
|
|
506
|
+
<div class="meta-value">{{ total_injections }}</div>
|
|
507
|
+
</div>
|
|
508
|
+
<div class="meta-item">
|
|
509
|
+
<div class="meta-label">Target Types</div>
|
|
510
|
+
<div class="meta-value">{{ target_types }}</div>
|
|
511
|
+
</div>
|
|
512
|
+
<div class="meta-item">
|
|
513
|
+
<div class="meta-label">Detection String</div>
|
|
514
|
+
<div class="meta-value">{{ detection_string if detection_string else 'None' }}</div>
|
|
515
|
+
</div>
|
|
516
|
+
<div class="meta-item">
|
|
517
|
+
<div class="meta-label">Completed At</div>
|
|
518
|
+
<div class="meta-value">{{ completed_at }}</div>
|
|
519
|
+
</div>
|
|
520
|
+
<div class="meta-item">
|
|
521
|
+
<div class="meta-label">Config File</div>
|
|
522
|
+
<div class="meta-value code" style="font-size: 0.85em; word-break: break-all;">{{ config_path }}</div>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
</section>
|
|
526
|
+
|
|
527
|
+
<section>
|
|
528
|
+
<h2>Results Summary</h2>
|
|
529
|
+
|
|
530
|
+
{% if statistics and statistics.total > 0 %}
|
|
531
|
+
|
|
532
|
+
<div class="stats-grid">
|
|
533
|
+
{% if statistics.masked.count > 0 %}
|
|
534
|
+
<div class="stat-card masked">
|
|
535
|
+
<div class="stat-value">{{ statistics.masked.count }}</div>
|
|
536
|
+
<div class="stat-label">Masked</div>
|
|
537
|
+
<div class="stat-percentage">{{ "%.1f"|format(statistics.masked.percentage) }}%</div>
|
|
538
|
+
</div>
|
|
539
|
+
{% endif %}
|
|
540
|
+
|
|
541
|
+
{% if statistics.detected.count > 0 %}
|
|
542
|
+
<div class="stat-card detected">
|
|
543
|
+
<div class="stat-value">{{ statistics.detected.count }}</div>
|
|
544
|
+
<div class="stat-label">Detected</div>
|
|
545
|
+
<div class="stat-percentage">{{ "%.1f"|format(statistics.detected.percentage) }}%</div>
|
|
546
|
+
</div>
|
|
547
|
+
{% endif %}
|
|
548
|
+
|
|
549
|
+
{% if statistics.sdc.count > 0 %}
|
|
550
|
+
<div class="stat-card sdc">
|
|
551
|
+
<div class="stat-value">{{ statistics.sdc.count }}</div>
|
|
552
|
+
<div class="stat-label">SDC</div>
|
|
553
|
+
<div class="stat-percentage">{{ "%.1f"|format(statistics.sdc.percentage) }}%</div>
|
|
554
|
+
</div>
|
|
555
|
+
{% endif %}
|
|
556
|
+
|
|
557
|
+
{% if statistics.crash.count > 0 %}
|
|
558
|
+
<div class="stat-card crash">
|
|
559
|
+
<div class="stat-value">{{ statistics.crash.count }}</div>
|
|
560
|
+
<div class="stat-label">Crash</div>
|
|
561
|
+
<div class="stat-percentage">{{ "%.1f"|format(statistics.crash.percentage) }}%</div>
|
|
562
|
+
</div>
|
|
563
|
+
{% endif %}
|
|
564
|
+
|
|
565
|
+
{% if statistics.timeout.count > 0 %}
|
|
566
|
+
<div class="stat-card timeout">
|
|
567
|
+
<div class="stat-value">{{ statistics.timeout.count }}</div>
|
|
568
|
+
<div class="stat-label">Timeout</div>
|
|
569
|
+
<div class="stat-percentage">{{ "%.1f"|format(statistics.timeout.percentage) }}%</div>
|
|
570
|
+
</div>
|
|
571
|
+
{% endif %}
|
|
572
|
+
</div>
|
|
573
|
+
|
|
574
|
+
{% if dmr_effectiveness > 0 %}
|
|
575
|
+
<div class="dmr-effectiveness">
|
|
576
|
+
<div class="dmr-value">{{ "%.1f"|format(dmr_effectiveness) }}%</div>
|
|
577
|
+
<div class="dmr-label">DMR Effectiveness</div>
|
|
578
|
+
<div style="margin-top: 10px; opacity: 0.9; font-size: 0.9em;">
|
|
579
|
+
Fault detection rate: DETECTED / (DETECTED + SDC + CRASH)
|
|
580
|
+
</div>
|
|
581
|
+
</div>
|
|
582
|
+
{% endif %}
|
|
583
|
+
|
|
584
|
+
<div class="chart-container">
|
|
585
|
+
<h3>Outcome Distribution</h3>
|
|
586
|
+
<div class="chart-wrapper">
|
|
587
|
+
<canvas id="outcomeChart"></canvas>
|
|
588
|
+
</div>
|
|
589
|
+
</div>
|
|
590
|
+
|
|
591
|
+
{% else %}
|
|
592
|
+
<div class="no-data">No injection results available</div>
|
|
593
|
+
{% endif %}
|
|
594
|
+
</section>
|
|
595
|
+
|
|
596
|
+
{% if top_sdc %}
|
|
597
|
+
<section>
|
|
598
|
+
<h2>Top SDC-Causing Injections</h2>
|
|
599
|
+
<p style="color: #6c757d; margin-bottom: 15px;">
|
|
600
|
+
Silent Data Corruption (SDC) injections that produced incorrect output without detection:
|
|
601
|
+
</p>
|
|
602
|
+
<table>
|
|
603
|
+
<thead>
|
|
604
|
+
<tr>
|
|
605
|
+
<th>ID</th>
|
|
606
|
+
<th>Instruction</th>
|
|
607
|
+
<th>Target</th>
|
|
608
|
+
<th>Target Name</th>
|
|
609
|
+
<th>Original Value</th>
|
|
610
|
+
<th>Faulty Value</th>
|
|
611
|
+
<th>Bit Position</th>
|
|
612
|
+
<th>State Match</th>
|
|
613
|
+
</tr>
|
|
614
|
+
</thead>
|
|
615
|
+
<tbody>
|
|
616
|
+
{% for inj in top_sdc %}
|
|
617
|
+
<tr>
|
|
618
|
+
<td>{{ inj.injection_id }}</td>
|
|
619
|
+
<td>{{ inj.instruction_count }}</td>
|
|
620
|
+
<td>{{ inj.target_type }}</td>
|
|
621
|
+
<td class="code">{{ inj.target_name }}</td>
|
|
622
|
+
<td class="code">{{ inj.original_value }}</td>
|
|
623
|
+
<td class="code">{{ inj.faulty_value }}</td>
|
|
624
|
+
<td>{{ inj.bit_position }}</td>
|
|
625
|
+
<td>{% if inj.state_match is not none %}{{ 'Yes' if inj.state_match else 'No' }}{% else %}-{% endif %}</td>
|
|
626
|
+
</tr>
|
|
627
|
+
{% endfor %}
|
|
628
|
+
</tbody>
|
|
629
|
+
</table>
|
|
630
|
+
</section>
|
|
631
|
+
{% endif %}
|
|
632
|
+
|
|
633
|
+
<footer>
|
|
634
|
+
<p>Generated by FIM (Fault Injection Manager) on {{ report_timestamp }}</p>
|
|
635
|
+
<p style="margin-top: 5px;">RISC-V C906 QEMU Simulation Framework</p>
|
|
636
|
+
</footer>
|
|
637
|
+
</div>
|
|
638
|
+
|
|
639
|
+
<script>
|
|
640
|
+
// Render pie chart for outcome distribution
|
|
641
|
+
{% if statistics and statistics.total > 0 %}
|
|
642
|
+
const ctx = document.getElementById('outcomeChart').getContext('2d');
|
|
643
|
+
const chartLabels = {{ chart_labels_json | safe }};
|
|
644
|
+
const chartValues = {{ chart_values_json | safe }};
|
|
645
|
+
const chartColors = {{ chart_colors_json | safe }};
|
|
646
|
+
|
|
647
|
+
new Chart(ctx, {
|
|
648
|
+
type: 'pie',
|
|
649
|
+
data: {
|
|
650
|
+
labels: chartLabels,
|
|
651
|
+
datasets: [{
|
|
652
|
+
data: chartValues,
|
|
653
|
+
backgroundColor: chartColors,
|
|
654
|
+
borderWidth: 2,
|
|
655
|
+
borderColor: '#fff'
|
|
656
|
+
}]
|
|
657
|
+
},
|
|
658
|
+
options: {
|
|
659
|
+
responsive: true,
|
|
660
|
+
maintainAspectRatio: true,
|
|
661
|
+
plugins: {
|
|
662
|
+
legend: {
|
|
663
|
+
position: 'bottom',
|
|
664
|
+
labels: {
|
|
665
|
+
padding: 15,
|
|
666
|
+
font: {
|
|
667
|
+
size: 14
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
tooltip: {
|
|
672
|
+
callbacks: {
|
|
673
|
+
label: function(context) {
|
|
674
|
+
const label = context.label || '';
|
|
675
|
+
const value = context.parsed || 0;
|
|
676
|
+
const total = context.dataset.data.reduce((a, b) => a + b, 0);
|
|
677
|
+
const percentage = ((value / total) * 100).toFixed(1);
|
|
678
|
+
return label + ': ' + value + ' (' + percentage + '%)';
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
{% endif %}
|
|
686
|
+
</script>
|
|
687
|
+
</body>
|
|
688
|
+
</html>
|
|
689
|
+
"""
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
def generate_report(campaign_id: str, results_dir: str = DEFAULT_RESULTS_DIR) -> str:
|
|
693
|
+
"""
|
|
694
|
+
Convenience function to generate report for a campaign.
|
|
695
|
+
|
|
696
|
+
Args:
|
|
697
|
+
campaign_id: Campaign identifier (directory name in results/).
|
|
698
|
+
results_dir: Base directory containing results (default: "results").
|
|
699
|
+
|
|
700
|
+
Returns:
|
|
701
|
+
Path to generated HTML report file.
|
|
702
|
+
|
|
703
|
+
Raises:
|
|
704
|
+
ReporterError: If report generation fails.
|
|
705
|
+
|
|
706
|
+
Example:
|
|
707
|
+
>>> report_path = generate_report("quicksort_dmr_20260203_143022_123456")
|
|
708
|
+
>>> print(f"Report: {report_path}")
|
|
709
|
+
Report: results/quicksort_dmr_20260203_143022_123456/report.html
|
|
710
|
+
"""
|
|
711
|
+
reporter = CampaignReporter(campaign_id, results_dir)
|
|
712
|
+
return reporter.generate_report()
|