amd_uprof
Safe wrapper for AMD uProf
Uses amd_uprof-sys for FFI. If you have issues with build, refer to amd_uprof-sys readme
Usage
Prerequisites
- If using CLI, add
-start-pausedoption. - if using GUI, make sure
Enable start pausedoption is enabled. - To enable the API, you'll need to call
amd_prof::enable(true)once at the beggining of the program.
Basic Usage
enable; // once at the start
// ...
// start profiling
resume_profiler;
// do some work
// stop profiling
pause_profiler;
Since resume_profiler and pause_profiler have very large overhead, there are also async versions that do not block:
resume_profiler_asyncpause_profiler_async
Event gathering will start/stop at some unspecified time after they are called.
Task Scopes
To use Tasks (unfortunately UProf GUI does not display them, so they are only useful with CLI):
enable; // once at the start
// ...
// start profiling
resume_profiler;
Line number and file name (nightly is enabled) will be automatically assigned to the beggining of the task, but not the end. If you need that, you'll have to manually drop the scope using finish() method:
enable; // once at the start
// ...
// start profiling
resume_profiler;
let task_scope = scope;
// do some work
task_scope.finish;
Features
nightly: Needed for associating file name with the task.