1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Toggle HIP profile collection from within a process. Mirrors
//! `cudarc::driver::safe::profile`. Pair with `rocprof` (or any tool
//! consuming `hipProfilerStart` / `hipProfilerStop`) to bracket the hot
//! path you want recorded.
use crate;
/// RAII profiler scope. Calls [`profiler_start`] in [`Profiler::new`] and
/// [`profiler_stop`] on drop.
///
/// ```no_run
/// use rocmrc::Profiler;
///
/// # fn run() -> Result<(), rocmrc::HipError> {
/// {
/// let _profiler = Profiler::new()?;
/// // Hot path — profiler stops automatically on drop.
/// }
/// # Ok(())
/// # }
/// // Then collect:
/// // rocprof --hip-trace /path/to/bin
/// ```
;
/// Enable profile collection by the active profiling tool for the
/// current context. If profiling is already on, this is a no-op. For an
/// RAII wrapper see [`Profiler::new`].
///
/// ```no_run
/// use rocmrc::{profiler_start, profiler_stop};
///
/// # fn run() -> Result<(), rocmrc::HipError> {
/// profiler_start()?;
/// // Hot path
/// profiler_stop()?;
/// # Ok(())
/// # }
/// ```
/// Disable profile collection for the current context. If profiling is
/// already off, this is a no-op.