xref: /aosp_15_r20/external/crosvm/perfetto/src/bindings.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1*bb4ee6a4SAndroid Build Coastguard Worker // Copyright 2023 The ChromiumOS Authors
2*bb4ee6a4SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*bb4ee6a4SAndroid Build Coastguard Worker // found in the LICENSE file.
4*bb4ee6a4SAndroid Build Coastguard Worker 
5*bb4ee6a4SAndroid Build Coastguard Worker #![allow(clippy::missing_safety_doc)]
6*bb4ee6a4SAndroid Build Coastguard Worker #![allow(clippy::upper_case_acronyms)]
7*bb4ee6a4SAndroid Build Coastguard Worker #![allow(non_upper_case_globals)]
8*bb4ee6a4SAndroid Build Coastguard Worker #![allow(non_camel_case_types)]
9*bb4ee6a4SAndroid Build Coastguard Worker #![allow(non_snake_case)]
10*bb4ee6a4SAndroid Build Coastguard Worker #![allow(dead_code)]
11*bb4ee6a4SAndroid Build Coastguard Worker 
12*bb4ee6a4SAndroid Build Coastguard Worker pub const __bool_true_false_are_defined: u32 = 1;
13*bb4ee6a4SAndroid Build Coastguard Worker pub const true_: u32 = 1;
14*bb4ee6a4SAndroid Build Coastguard Worker pub const false_: u32 = 0;
15*bb4ee6a4SAndroid Build Coastguard Worker pub const _VCRT_COMPILER_PREPROCESSOR: u32 = 1;
16*bb4ee6a4SAndroid Build Coastguard Worker pub const _SAL_VERSION: u32 = 20;
17*bb4ee6a4SAndroid Build Coastguard Worker pub const __SAL_H_VERSION: u32 = 180000000;
18*bb4ee6a4SAndroid Build Coastguard Worker pub const _USE_DECLSPECS_FOR_SAL: u32 = 0;
19*bb4ee6a4SAndroid Build Coastguard Worker pub const _USE_ATTRIBUTES_FOR_SAL: u32 = 0;
20*bb4ee6a4SAndroid Build Coastguard Worker pub const _CRT_PACKING: u32 = 8;
21*bb4ee6a4SAndroid Build Coastguard Worker pub const _HAS_EXCEPTIONS: u32 = 1;
22*bb4ee6a4SAndroid Build Coastguard Worker pub const _STL_LANG: u32 = 0;
23*bb4ee6a4SAndroid Build Coastguard Worker pub const _HAS_CXX17: u32 = 0;
24*bb4ee6a4SAndroid Build Coastguard Worker pub const _HAS_CXX20: u32 = 0;
25*bb4ee6a4SAndroid Build Coastguard Worker pub const _HAS_NODISCARD: u32 = 0;
26*bb4ee6a4SAndroid Build Coastguard Worker pub const WCHAR_MIN: u32 = 0;
27*bb4ee6a4SAndroid Build Coastguard Worker pub const WCHAR_MAX: u32 = 65535;
28*bb4ee6a4SAndroid Build Coastguard Worker pub const WINT_MIN: u32 = 0;
29*bb4ee6a4SAndroid Build Coastguard Worker pub const WINT_MAX: u32 = 65535;
30*bb4ee6a4SAndroid Build Coastguard Worker pub const CTRACE_API_VERSION: u32 = 1;
31*bb4ee6a4SAndroid Build Coastguard Worker pub const _CTRACE_TYPE_SLICE_BEGIN: u32 = 1;
32*bb4ee6a4SAndroid Build Coastguard Worker pub const _CTRACE_TYPE_SLICE_END: u32 = 2;
33*bb4ee6a4SAndroid Build Coastguard Worker pub type wchar_t = ::std::os::raw::c_ushort;
34*bb4ee6a4SAndroid Build Coastguard Worker pub type max_align_t = f64;
35*bb4ee6a4SAndroid Build Coastguard Worker pub type va_list = *mut ::std::os::raw::c_char;
36*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
__va_start(arg1: *mut *mut ::std::os::raw::c_char, ...)37*bb4ee6a4SAndroid Build Coastguard Worker     pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
38*bb4ee6a4SAndroid Build Coastguard Worker }
39*bb4ee6a4SAndroid Build Coastguard Worker pub type __vcrt_bool = bool;
40*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
__security_init_cookie()41*bb4ee6a4SAndroid Build Coastguard Worker     pub fn __security_init_cookie();
42*bb4ee6a4SAndroid Build Coastguard Worker }
43*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
__security_check_cookie(_StackCookie: usize)44*bb4ee6a4SAndroid Build Coastguard Worker     pub fn __security_check_cookie(_StackCookie: usize);
45*bb4ee6a4SAndroid Build Coastguard Worker }
46*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
__report_gsfailure(_StackCookie: usize) -> !47*bb4ee6a4SAndroid Build Coastguard Worker     pub fn __report_gsfailure(_StackCookie: usize) -> !;
48*bb4ee6a4SAndroid Build Coastguard Worker }
49*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
50*bb4ee6a4SAndroid Build Coastguard Worker     pub static mut __security_cookie: usize;
51*bb4ee6a4SAndroid Build Coastguard Worker }
52*bb4ee6a4SAndroid Build Coastguard Worker pub type int_least8_t = ::std::os::raw::c_schar;
53*bb4ee6a4SAndroid Build Coastguard Worker pub type int_least16_t = ::std::os::raw::c_short;
54*bb4ee6a4SAndroid Build Coastguard Worker pub type int_least32_t = ::std::os::raw::c_int;
55*bb4ee6a4SAndroid Build Coastguard Worker pub type int_least64_t = ::std::os::raw::c_longlong;
56*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_least8_t = ::std::os::raw::c_uchar;
57*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_least16_t = ::std::os::raw::c_ushort;
58*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_least32_t = ::std::os::raw::c_uint;
59*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_least64_t = ::std::os::raw::c_ulonglong;
60*bb4ee6a4SAndroid Build Coastguard Worker pub type int_fast8_t = ::std::os::raw::c_schar;
61*bb4ee6a4SAndroid Build Coastguard Worker pub type int_fast16_t = ::std::os::raw::c_int;
62*bb4ee6a4SAndroid Build Coastguard Worker pub type int_fast32_t = ::std::os::raw::c_int;
63*bb4ee6a4SAndroid Build Coastguard Worker pub type int_fast64_t = ::std::os::raw::c_longlong;
64*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_fast8_t = ::std::os::raw::c_uchar;
65*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_fast16_t = ::std::os::raw::c_uint;
66*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_fast32_t = ::std::os::raw::c_uint;
67*bb4ee6a4SAndroid Build Coastguard Worker pub type uint_fast64_t = ::std::os::raw::c_ulonglong;
68*bb4ee6a4SAndroid Build Coastguard Worker pub type intmax_t = ::std::os::raw::c_longlong;
69*bb4ee6a4SAndroid Build Coastguard Worker pub type uintmax_t = ::std::os::raw::c_ulonglong;
70*bb4ee6a4SAndroid Build Coastguard Worker pub const BackendType_CTRACE_UNSPECIFIED_BACKEND: BackendType = 0;
71*bb4ee6a4SAndroid Build Coastguard Worker pub const BackendType_CTRACE_IN_PROCESS_BACKEND: BackendType = 1;
72*bb4ee6a4SAndroid Build Coastguard Worker pub const BackendType_CTRACE_SYSTEM_BACKEND: BackendType = 2;
73*bb4ee6a4SAndroid Build Coastguard Worker pub type BackendType = ::std::os::raw::c_int;
74*bb4ee6a4SAndroid Build Coastguard Worker #[repr(C)]
75*bb4ee6a4SAndroid Build Coastguard Worker #[derive(Debug, Copy, Clone)]
76*bb4ee6a4SAndroid Build Coastguard Worker pub struct ctrace_category {
77*bb4ee6a4SAndroid Build Coastguard Worker     pub client_index: u64,
78*bb4ee6a4SAndroid Build Coastguard Worker     pub instances_callback:
79*bb4ee6a4SAndroid Build Coastguard Worker         ::std::option::Option<unsafe extern "C" fn(instances: u32, client_index: u64)>,
80*bb4ee6a4SAndroid Build Coastguard Worker     pub name: *const ::std::os::raw::c_char,
81*bb4ee6a4SAndroid Build Coastguard Worker     pub description: *const ::std::os::raw::c_char,
82*bb4ee6a4SAndroid Build Coastguard Worker     pub tags: [*const ::std::os::raw::c_char; 4usize],
83*bb4ee6a4SAndroid Build Coastguard Worker }
84*bb4ee6a4SAndroid Build Coastguard Worker impl Default for ctrace_category {
default() -> Self85*bb4ee6a4SAndroid Build Coastguard Worker     fn default() -> Self {
86*bb4ee6a4SAndroid Build Coastguard Worker         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
87*bb4ee6a4SAndroid Build Coastguard Worker         unsafe {
88*bb4ee6a4SAndroid Build Coastguard Worker             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
89*bb4ee6a4SAndroid Build Coastguard Worker             s.assume_init()
90*bb4ee6a4SAndroid Build Coastguard Worker         }
91*bb4ee6a4SAndroid Build Coastguard Worker     }
92*bb4ee6a4SAndroid Build Coastguard Worker }
93*bb4ee6a4SAndroid Build Coastguard Worker #[repr(C)]
94*bb4ee6a4SAndroid Build Coastguard Worker #[derive(Debug, Default, Copy, Clone)]
95*bb4ee6a4SAndroid Build Coastguard Worker pub struct ctrace_clock {
96*bb4ee6a4SAndroid Build Coastguard Worker     pub clock_id: u32,
97*bb4ee6a4SAndroid Build Coastguard Worker     pub timestamp: u64,
98*bb4ee6a4SAndroid Build Coastguard Worker     pub is_incremental: bool,
99*bb4ee6a4SAndroid Build Coastguard Worker     pub unit_multiplier_ns: u64,
100*bb4ee6a4SAndroid Build Coastguard Worker }
101*bb4ee6a4SAndroid Build Coastguard Worker #[repr(C)]
102*bb4ee6a4SAndroid Build Coastguard Worker #[derive(Debug, Default, Copy, Clone)]
103*bb4ee6a4SAndroid Build Coastguard Worker pub struct ctrace_clock_snapshot {
104*bb4ee6a4SAndroid Build Coastguard Worker     pub clocks: [ctrace_clock; 2usize],
105*bb4ee6a4SAndroid Build Coastguard Worker }
106*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_register_categories(c_cats: *const *const ctrace_category, max: u64) -> u64107*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_register_categories(c_cats: *const *const ctrace_category, max: u64) -> u64;
108*bb4ee6a4SAndroid Build Coastguard Worker }
109*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_add_clock_snapshot(snapshot: *mut ctrace_clock_snapshot)110*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_add_clock_snapshot(snapshot: *mut ctrace_clock_snapshot);
111*bb4ee6a4SAndroid Build Coastguard Worker }
112*bb4ee6a4SAndroid Build Coastguard Worker #[repr(C)]
113*bb4ee6a4SAndroid Build Coastguard Worker #[derive(Debug, Default, Copy, Clone)]
114*bb4ee6a4SAndroid Build Coastguard Worker pub struct ctrace_init_args {
115*bb4ee6a4SAndroid Build Coastguard Worker     pub api_version: u32,
116*bb4ee6a4SAndroid Build Coastguard Worker     pub backend: u32,
117*bb4ee6a4SAndroid Build Coastguard Worker     pub shmem_size_hint_kb: u32,
118*bb4ee6a4SAndroid Build Coastguard Worker     pub shmem_page_size_hint_kb: u32,
119*bb4ee6a4SAndroid Build Coastguard Worker     pub shmem_batch_commits_duration_ms: u32,
120*bb4ee6a4SAndroid Build Coastguard Worker }
121*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_init(arg1: *const ctrace_init_args)122*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_init(arg1: *const ctrace_init_args);
123*bb4ee6a4SAndroid Build Coastguard Worker }
124*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_event_begin( category_index: u64, instances: u32, name: *const ::std::os::raw::c_char, )125*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_event_begin(
126*bb4ee6a4SAndroid Build Coastguard Worker         category_index: u64,
127*bb4ee6a4SAndroid Build Coastguard Worker         instances: u32,
128*bb4ee6a4SAndroid Build Coastguard Worker         name: *const ::std::os::raw::c_char,
129*bb4ee6a4SAndroid Build Coastguard Worker     );
130*bb4ee6a4SAndroid Build Coastguard Worker }
131*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_event_end(category_index: u64, instances: u32)132*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_event_end(category_index: u64, instances: u32);
133*bb4ee6a4SAndroid Build Coastguard Worker }
134*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_event_instant( category_index: u64, instances: u32, name: *const ::std::os::raw::c_char, )135*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_event_instant(
136*bb4ee6a4SAndroid Build Coastguard Worker         category_index: u64,
137*bb4ee6a4SAndroid Build Coastguard Worker         instances: u32,
138*bb4ee6a4SAndroid Build Coastguard Worker         name: *const ::std::os::raw::c_char,
139*bb4ee6a4SAndroid Build Coastguard Worker     );
140*bb4ee6a4SAndroid Build Coastguard Worker }
141*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_counter( category_index: u64, instances: u32, track: *const ::std::os::raw::c_char, value: i64, )142*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_counter(
143*bb4ee6a4SAndroid Build Coastguard Worker         category_index: u64,
144*bb4ee6a4SAndroid Build Coastguard Worker         instances: u32,
145*bb4ee6a4SAndroid Build Coastguard Worker         track: *const ::std::os::raw::c_char,
146*bb4ee6a4SAndroid Build Coastguard Worker         value: i64,
147*bb4ee6a4SAndroid Build Coastguard Worker     );
148*bb4ee6a4SAndroid Build Coastguard Worker }
149*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_create_async( category_index: u64, instances: u32, name: *const ::std::os::raw::c_char, ) -> u64150*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_create_async(
151*bb4ee6a4SAndroid Build Coastguard Worker         category_index: u64,
152*bb4ee6a4SAndroid Build Coastguard Worker         instances: u32,
153*bb4ee6a4SAndroid Build Coastguard Worker         name: *const ::std::os::raw::c_char,
154*bb4ee6a4SAndroid Build Coastguard Worker     ) -> u64;
155*bb4ee6a4SAndroid Build Coastguard Worker }
156*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_begin_async( category_index: u64, instances: u32, name: *const ::std::os::raw::c_char, terminating_flow_id: u64, )157*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_begin_async(
158*bb4ee6a4SAndroid Build Coastguard Worker         category_index: u64,
159*bb4ee6a4SAndroid Build Coastguard Worker         instances: u32,
160*bb4ee6a4SAndroid Build Coastguard Worker         name: *const ::std::os::raw::c_char,
161*bb4ee6a4SAndroid Build Coastguard Worker         terminating_flow_id: u64,
162*bb4ee6a4SAndroid Build Coastguard Worker     );
163*bb4ee6a4SAndroid Build Coastguard Worker }
164*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_pause_async(category_index: u64, instances: u32) -> u64165*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_pause_async(category_index: u64, instances: u32) -> u64;
166*bb4ee6a4SAndroid Build Coastguard Worker }
167*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
trace_end_async(category_index: u64, instances: u32)168*bb4ee6a4SAndroid Build Coastguard Worker     pub fn trace_end_async(category_index: u64, instances: u32);
169*bb4ee6a4SAndroid Build Coastguard Worker }
170*bb4ee6a4SAndroid Build Coastguard Worker #[repr(C)]
171*bb4ee6a4SAndroid Build Coastguard Worker #[derive(Debug, Default, Copy, Clone)]
172*bb4ee6a4SAndroid Build Coastguard Worker pub struct ctrace_trace_config {
173*bb4ee6a4SAndroid Build Coastguard Worker     pub duration_ms: u32,
174*bb4ee6a4SAndroid Build Coastguard Worker     pub buffer_size_kb: u32,
175*bb4ee6a4SAndroid Build Coastguard Worker }
176*bb4ee6a4SAndroid Build Coastguard Worker pub type ctrace_trace_session_handle = *mut ::std::os::raw::c_void;
177*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_trace_start(arg1: *const ctrace_trace_config) -> ctrace_trace_session_handle178*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_trace_start(arg1: *const ctrace_trace_config) -> ctrace_trace_session_handle;
179*bb4ee6a4SAndroid Build Coastguard Worker }
180*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_trace_start_from_config_proto( arg1: *mut ::std::os::raw::c_void, arg2: u64, ) -> ctrace_trace_session_handle181*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_trace_start_from_config_proto(
182*bb4ee6a4SAndroid Build Coastguard Worker         arg1: *mut ::std::os::raw::c_void,
183*bb4ee6a4SAndroid Build Coastguard Worker         arg2: u64,
184*bb4ee6a4SAndroid Build Coastguard Worker     ) -> ctrace_trace_session_handle;
185*bb4ee6a4SAndroid Build Coastguard Worker }
186*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_trace_stop( arg1: ctrace_trace_session_handle, arg2: *const ::std::os::raw::c_char, )187*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_trace_stop(
188*bb4ee6a4SAndroid Build Coastguard Worker         arg1: ctrace_trace_session_handle,
189*bb4ee6a4SAndroid Build Coastguard Worker         arg2: *const ::std::os::raw::c_char,
190*bb4ee6a4SAndroid Build Coastguard Worker     );
191*bb4ee6a4SAndroid Build Coastguard Worker }
192*bb4ee6a4SAndroid Build Coastguard Worker #[repr(C)]
193*bb4ee6a4SAndroid Build Coastguard Worker #[derive(Debug, Copy, Clone)]
194*bb4ee6a4SAndroid Build Coastguard Worker pub struct ctrace_trace_buffer {
195*bb4ee6a4SAndroid Build Coastguard Worker     pub std_vec: *mut ::std::os::raw::c_void,
196*bb4ee6a4SAndroid Build Coastguard Worker     pub data: *mut ::std::os::raw::c_void,
197*bb4ee6a4SAndroid Build Coastguard Worker     pub size: u64,
198*bb4ee6a4SAndroid Build Coastguard Worker }
199*bb4ee6a4SAndroid Build Coastguard Worker impl Default for ctrace_trace_buffer {
default() -> Self200*bb4ee6a4SAndroid Build Coastguard Worker     fn default() -> Self {
201*bb4ee6a4SAndroid Build Coastguard Worker         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
202*bb4ee6a4SAndroid Build Coastguard Worker         unsafe {
203*bb4ee6a4SAndroid Build Coastguard Worker             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
204*bb4ee6a4SAndroid Build Coastguard Worker             s.assume_init()
205*bb4ee6a4SAndroid Build Coastguard Worker         }
206*bb4ee6a4SAndroid Build Coastguard Worker     }
207*bb4ee6a4SAndroid Build Coastguard Worker }
208*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_free_trace_buffer(arg1: *mut ctrace_trace_buffer)209*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_free_trace_buffer(arg1: *mut ctrace_trace_buffer);
210*bb4ee6a4SAndroid Build Coastguard Worker }
211*bb4ee6a4SAndroid Build Coastguard Worker extern "C" {
ctrace_trace_stop_to_buffer(arg1: ctrace_trace_session_handle) -> ctrace_trace_buffer212*bb4ee6a4SAndroid Build Coastguard Worker     pub fn ctrace_trace_stop_to_buffer(arg1: ctrace_trace_session_handle) -> ctrace_trace_buffer;
213*bb4ee6a4SAndroid Build Coastguard Worker }
214