amd_uprof 0.1.1

Safe wrappers for amd_uprof-sys
Documentation
  • Coverage
  • 0%
    0 out of 9 items documented0 out of 8 items with examples
  • Size
  • Source code size: 7.28 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.36 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • vdrn/amd_uprof
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vdrn

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-paused option.
  • if using GUI, make sure Enable start paused option is enabled.
  • To enable the API, you'll need to call amd_prof::enable(true) once at the beggining of the program.

Basic Usage


amd_uprof::enable(true);  // once at the start

// ...

// start profiling
amd_uprof::resume_profiler();

// do some work

// stop profiling 
amd_uprof::pause_profiler();

Since resume_profiler and pause_profiler have very large overhead, there are also async versions that do not block:

  • resume_profiler_async
  • pause_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):

amd_uprof::enable(true);  // once at the start

// ...

// start profiling
amd_uprof::resume_profiler();

{
 let _task_scope =  amd_prof::scope("domain", "name");
 
 // do some work

 // scope will be automaticall closed
}

Start events automatically include line numbers and filenames (when nightly is enabled), but end events don't. To include this information in end events as well, manually close the scope with the finish() method:

amd_uprof::enable(true);  // once at the start

// ...

// start profiling
amd_uprof::resume_profiler();

let task_scope = amd_prof::scope("domain", "name");

// do some work

task_scope.finish();

Features

  • nightly: Needed for associating file name with the task.