PR-07 telemetry + certs
This commit is contained in:
@@ -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(),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user