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