TermUI.Dev.PerfMonitor (TermUI v0.2.0)

View Source

Performance Monitor for development mode.

Displays real-time performance metrics: FPS, frame time, memory usage, and process count. Toggle with Ctrl+Shift+P when dev mode is enabled.

Metrics

  • FPS: Frames per second (rolling average)
  • Frame Time: Time to render each frame (graph)
  • Memory: Total BEAM memory usage
  • Processes: Number of BEAM processes

Summary

Functions

Formats bytes into human-readable string.

Formats microseconds into human-readable string.

Gets detailed BEAM memory breakdown.

Gets message queue length for a process.

Gets reduction count for a process (rough CPU usage indicator).

Gets scheduler utilization.

Renders the performance monitor panel.

Calculates sparkline characters for a list of values.

Functions

format_bytes(bytes)

@spec format_bytes(integer()) :: String.t()

Formats bytes into human-readable string.

format_time(us)

@spec format_time(integer()) :: String.t()

Formats microseconds into human-readable string.

get_memory_breakdown()

@spec get_memory_breakdown() :: map()

Gets detailed BEAM memory breakdown.

get_message_queue_length(pid)

@spec get_message_queue_length(pid()) :: integer()

Gets message queue length for a process.

get_reductions(pid)

@spec get_reductions(pid()) :: integer()

Gets reduction count for a process (rough CPU usage indicator).

get_scheduler_utilization()

@spec get_scheduler_utilization() :: [float()]

Gets scheduler utilization.

render(metrics, area)

@spec render(map(), map()) :: term()

Renders the performance monitor panel.

Returns render nodes for the metrics display.

values_to_sparkline(values, min_val, max_val)

@spec values_to_sparkline([number()], number(), number()) :: String.t()

Calculates sparkline characters for a list of values.