stormlog.tui.monitor

Helpers for bridging MemoryTracker data into the Textual TUI.

Classes

TrackerEventView(timestamp, event_type, ...)

Lightweight view model for displaying tracking events.

TrackerSession(*[, sampling_interval, ...])

Stateful adapter that exposes MemoryTracker data (GPU or CPU) to the TUI.

Exceptions

TrackerUnavailableError

Raised when the MemoryTracker backend cannot be initialized.

exception stormlog.tui.monitor.TrackerUnavailableError[source]

Bases: RuntimeError

Raised when the MemoryTracker backend cannot be initialized.

class stormlog.tui.monitor.TrackerEventView(timestamp, event_type, message, allocated, reserved, change)[source]

Bases: object

Lightweight view model for displaying tracking events.

Parameters:
  • timestamp (float)

  • event_type (str)

  • message (str)

  • allocated (str)

  • reserved (str)

  • change (str)

timestamp: float
event_type: str
message: str
allocated: str
reserved: str
change: str
class stormlog.tui.monitor.TrackerSession(*, sampling_interval=0.5, auto_cleanup=False, max_events_per_poll=50, max_events=10000, telemetry_sink_config=None)[source]

Bases: object

Stateful adapter that exposes MemoryTracker data (GPU or CPU) to the TUI.

Parameters:
  • sampling_interval (float)

  • auto_cleanup (bool)

  • max_events_per_poll (int)

  • max_events (int)

  • telemetry_sink_config (Optional[TelemetrySinkConfig])

property is_active: bool
start(**tracker_kwargs)[source]

Start the underlying MemoryTracker.

Parameters:

tracker_kwargs (Any)

Return type:

None

stop()[source]

Stop tracking and release state.

Return type:

None

pull_events()[source]

Return newly observed events as lightweight view models.

Return type:

List[TrackerEventView]

get_statistics()[source]

Expose the current tracker statistics.

Return type:

Dict[str, Any]

get_memory_timeline(interval=1.0)[source]

Return aggregated timeline data from the tracker.

Parameters:

interval (float)

Return type:

Dict[str, Any]

get_telemetry_events()[source]

Return normalized telemetry events from the active tracker session.

Return type:

list[TelemetryEventV3]

telemetry_records()[source]

Return backend-neutral projected telemetry records from the live tracker.

Return type:

list[ProjectedTelemetryRecord]

get_session_summary()[source]

Return the underlying tracker session summary when available.

Return type:

SessionSummary | None

get_device_label()[source]

Return the CUDA device label, if tracking.

Return type:

str | None

clear_events()[source]

Clear buffered events and reset the poll cursor.

Return type:

None

get_cleanup_stats()[source]

Return watchdog cleanup stats if available.

Return type:

Dict[str, Any]

set_auto_cleanup(enabled)[source]

Toggle automatic watchdog cleanup.

Parameters:

enabled (bool)

Return type:

None

force_cleanup(aggressive=False)[source]

Trigger a watchdog cleanup run.

Parameters:

aggressive (bool)

Return type:

bool

export_events(file_path, format='csv')[source]

Export tracker events to a file.

Parameters:
  • file_path (str)

  • format (str)

Return type:

bool

get_thresholds()[source]
Return type:

Dict[str, float]

set_thresholds(warning, critical)[source]
Parameters:
  • warning (float)

  • critical (float)

Return type:

None