prometeu-runtime/docs/runtime/specs/01-time-model-and-cycles.md

3.0 KiB

Time Model and Cycles

Domain: machine timing and cycles Function: normative

Didactic companion: ../learn/mental-model-time-and-cycles.md

1 Scope

This chapter defines the temporal contract of the PROMETEU machine.

It covers:

  • machine base clock;
  • logical frame structure;
  • cycle accounting;
  • per-frame budget;
  • CAP interaction with time measurement.

2 System Base Clock

PROMETEU operates with a fixed 60 Hz logical clock.

This means:

  • 60 iterations of the machine loop per second;
  • each iteration corresponds to one logical frame;
  • the logical clock is stable regardless of host platform.

3 Logical Frame

A PROMETEU frame represents a complete unit of machine execution.

Conceptual stage order:

FRAME N
INPUT
UPDATE
DRAW
AUDIO
SYNC

The machine guarantees:

  • fixed stage order;
  • deterministic repetition;
  • no implicit extra frames between logical frame boundaries.

4 PROMETEU Cycles

4.1 Definition

A PROMETEU cycle is the abstract unit used to measure execution cost inside the machine.

  • VM instructions consume documented cycle cost;
  • peripheral operations also consume cycle cost;
  • cycle cost is independent of host wall-clock timing.

4.2 Properties

Cycles are:

  • countable;
  • comparable;
  • stable across supported hosts;
  • suitable for certification and profiling.

5 Per-Frame Budget

Each frame has a maximum cycle budget.

This budget:

  • is reset every frame;
  • does not accumulate unused cycles;
  • represents the capacity of the virtual execution envelope for that frame.

5.1 Conceptual Example

Frame Budget: 10,000 cycles

Used:
- Update logic: 4,200
- Draw calls: 3,100
- Audio: 900

Remaining:
1,800 cycles

6 Work Distribution Over Time

PROMETEU does not require all logic to run every frame.

Machine-visible work may be distributed over time, for example:

  • enemy logic every 2 frames;
  • pathfinding every 4 frames;
  • timers based on frame count;
  • subsystem-specific update cadence.

Such distribution changes cycle pressure and is part of the observable execution model.

7 CAP Interaction

The CAP defines contextual technical limits such as:

  • maximum cycle budget per frame;
  • memory limits;
  • peripheral call limits.

7.1 CAP Does Not Block Execution

Fundamental rules:

  • the game always runs;
  • the game can always be packaged;
  • the game can always be played.

CAP does not prevent execution.

7.2 CAP Generates Evidence

When CAP is active, PROMETEU measures and records:

  • average cycle usage per frame;
  • cycle peaks;
  • problematic frames;
  • cost distribution.

These data feed certification artifacts without changing cartridge semantics.

8 Time-Based Certification

PROMETEU certification may analyze:

  • average cycle usage per frame;
  • maximum peaks;
  • problematic frames;
  • dominant cost sources.

8.1 Conceptual Example

Target CAP: PROMETEU-LITE
Frame Budget: 5,000 cycles

Frame 18231:
Used: 5,612 cycles

Primary cause:
enemy.updateAI(): 1,012 cycles