Mojo module
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 gpu import profiler
with profiler.ProfileBlock("my_kernel"):
# Code to profile
run_gpu_kernel()
from gpu import profiler
with profiler.ProfileBlock("my_kernel"):
# Code to profile
run_gpu_kernel()
Structs
-
ProfileBlock
: A struct for profiling code blocks.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!