PR-07 telemetry + certs

This commit is contained in:
Nilton Constantino
2026-01-16 23:34:03 +00:00
parent c37b7aca46
commit b9c278c427
9 changed files with 349 additions and 14 deletions
@@ -16,6 +16,7 @@ pub enum LogicalFrameEndingReason {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BudgetReport {
pub cycles_used: u64,
pub steps_executed: u32,
pub reason: LogicalFrameEndingReason,
}
@@ -70,6 +71,7 @@ impl VirtualMachine {
hw: &mut dyn HardwareBridge,
) -> Result<BudgetReport, String> {
let start_cycles = self.cycles;
let mut steps_executed = 0;
let mut ending_reason: Option<LogicalFrameEndingReason> = None;
while (self.cycles - start_cycles) < budget
@@ -85,11 +87,13 @@ impl VirtualMachine {
if opcode == OpCode::FrameSync {
self.pc += 2;
self.cycles += OpCode::FrameSync.cycles();
steps_executed += 1;
ending_reason = Some(LogicalFrameEndingReason::FrameSync);
break;
}
self.step(native, hw)?;
steps_executed += 1;
// garante progresso real
if self.pc == pc_before && self.cycles == cycles_before && !self.halted {
@@ -109,6 +113,7 @@ impl VirtualMachine {
Ok(BudgetReport {
cycles_used: self.cycles - start_cycles,
steps_executed,
reason: ending_reason.unwrap(),
})
}