Skip to main content
Version: Nightly

profiler

This module provides GPU profiling functionality.

The profiler module enables performance profiling of GPU code blocks through a simple context manager interface. It includes:

  • ProfileBlock: A context manager for timing code blocks
  • Configurable profiling that can be enabled/disabled at compile time
  • Nanosecond precision timing using perf_counter_ns()
  • Source location tracking for profiled blocks
  • Formatted timing output

Example:

from std.gpu import profiler

with profiler.ProfileBlock("my_kernel"):
# Code to profile
pass

Structs