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
define_api_id!(0x8459_b1a3_a7d6_4155, "profiler-v0");
use bytemuck::Pod;
use bytemuck::Zeroable;
/// `puffin::StreamInfo` minus the actual stream.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Pod, Zeroable)]
#[repr(C)]
pub struct StreamMeta {
pub num_scopes: u64,
pub depth: u64,
pub range_ns_min: i64,
pub range_ns_max: i64,
}
#[ark_api_macros::ark_bindgen(imports = "ark-profiler-v0")]
mod profiler {
use super::StreamMeta;
extern "C" {
/// Returns the current time in nanoseconds
///
/// Used for high precision profiling and is only supported for profiling. May return 0 if profiling is not enabled.
/// Can't be used for absolute time determination, only relative difference between calls.
#[deprecated_infallible]
pub fn now_ns() -> i64;
#[deprecated(note = "Use `report_thread_stream_info` instead")] // 2021-08-23
#[deprecated_infallible]
pub fn report_thread_stream(stream: &[u8]);
/// Report Puffin profiler event stream.
#[deprecated_infallible]
pub fn report_thread_stream_info(meta: &StreamMeta, stream: &[u8]);
/// Is the module-side profiler on?
///
/// Call `puffin::set_scopes_on(ark::profiler::is_active());`
/// at the top of each frame to heed this.
pub fn is_active() -> bool;
}
}
pub use profiler::*;