hitrace_sys/hitrace_ffi.rs
1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6
7#[repr(C)]
8#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
9pub struct __BindgenBitfieldUnit<Storage> {
10 storage: Storage,
11}
12impl<Storage> __BindgenBitfieldUnit<Storage> {
13 #[inline]
14 pub const fn new(storage: Storage) -> Self {
15 Self { storage }
16 }
17}
18impl<Storage> __BindgenBitfieldUnit<Storage>
19where
20 Storage: AsRef<[u8]> + AsMut<[u8]>,
21{
22 #[inline]
23 fn extract_bit(byte: u8, index: usize) -> bool {
24 let bit_index = if cfg!(target_endian = "big") {
25 7 - (index % 8)
26 } else {
27 index % 8
28 };
29 let mask = 1 << bit_index;
30 byte & mask == mask
31 }
32 #[inline]
33 pub fn get_bit(&self, index: usize) -> bool {
34 debug_assert!(index / 8 < self.storage.as_ref().len());
35 let byte_index = index / 8;
36 let byte = self.storage.as_ref()[byte_index];
37 Self::extract_bit(byte, index)
38 }
39 #[inline]
40 pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
41 debug_assert!(index / 8 < core::mem::size_of::<Storage>());
42 let byte_index = index / 8;
43 let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
44 Self::extract_bit(byte, index)
45 }
46 #[inline]
47 fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
48 let bit_index = if cfg!(target_endian = "big") {
49 7 - (index % 8)
50 } else {
51 index % 8
52 };
53 let mask = 1 << bit_index;
54 if val {
55 byte | mask
56 } else {
57 byte & !mask
58 }
59 }
60 #[inline]
61 pub fn set_bit(&mut self, index: usize, val: bool) {
62 debug_assert!(index / 8 < self.storage.as_ref().len());
63 let byte_index = index / 8;
64 let byte = &mut self.storage.as_mut()[byte_index];
65 *byte = Self::change_bit(*byte, index, val);
66 }
67 #[inline]
68 pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
69 debug_assert!(index / 8 < core::mem::size_of::<Storage>());
70 let byte_index = index / 8;
71 let byte =
72 (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
73 *byte = Self::change_bit(*byte, index, val);
74 }
75 #[inline]
76 pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
77 debug_assert!(bit_width <= 64);
78 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
79 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
80 let mut val = 0;
81 for i in 0..(bit_width as usize) {
82 if self.get_bit(i + bit_offset) {
83 let index = if cfg!(target_endian = "big") {
84 bit_width as usize - 1 - i
85 } else {
86 i
87 };
88 val |= 1 << index;
89 }
90 }
91 val
92 }
93 #[inline]
94 pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
95 debug_assert!(bit_width <= 64);
96 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
97 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
98 let mut val = 0;
99 for i in 0..(bit_width as usize) {
100 if Self::raw_get_bit(this, i + bit_offset) {
101 let index = if cfg!(target_endian = "big") {
102 bit_width as usize - 1 - i
103 } else {
104 i
105 };
106 val |= 1 << index;
107 }
108 }
109 val
110 }
111 #[inline]
112 pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
113 debug_assert!(bit_width <= 64);
114 debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
115 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
116 for i in 0..(bit_width as usize) {
117 let mask = 1 << i;
118 let val_bit_is_set = val & mask == mask;
119 let index = if cfg!(target_endian = "big") {
120 bit_width as usize - 1 - i
121 } else {
122 i
123 };
124 self.set_bit(index + bit_offset, val_bit_is_set);
125 }
126 }
127 #[inline]
128 pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
129 debug_assert!(bit_width <= 64);
130 debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
131 debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
132 for i in 0..(bit_width as usize) {
133 let mask = 1 << i;
134 let val_bit_is_set = val & mask == mask;
135 let index = if cfg!(target_endian = "big") {
136 bit_width as usize - 1 - i
137 } else {
138 i
139 };
140 Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
141 }
142 }
143}
144#[cfg(feature = "api-12")]
145#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
146impl HiTraceId_Valid {
147 /// Invalid <b>HiTraceId</b> instance.
148 ///
149 ///
150 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
151 ///
152 ///
153 /// Available since API-level: 12
154 #[cfg(feature = "api-12")]
155 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
156 pub const HITRACE_ID_INVALID: HiTraceId_Valid = HiTraceId_Valid(0);
157 /// Valid <b>HiTraceId</b> instance.
158 ///
159 ///
160 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
161 ///
162 ///
163 /// Available since API-level: 12
164 #[cfg(feature = "api-12")]
165 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
166 pub const HITRACE_ID_VALID: HiTraceId_Valid = HiTraceId_Valid(1);
167}
168#[repr(transparent)]
169/// Defines whether a <b>HiTraceId</b> instance is valid.
170///
171///
172/// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
173///
174///
175/// Available since API-level: 12
176#[cfg(feature = "api-12")]
177#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
178#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
179pub struct HiTraceId_Valid(pub ::core::ffi::c_uint);
180#[cfg(feature = "api-12")]
181#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
182impl HiTrace_Version {
183 /// Version 1.
184 ///
185 ///
186 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
187 ///
188 ///
189 /// Available since API-level: 12
190 #[cfg(feature = "api-12")]
191 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
192 pub const HITRACE_VER_1: HiTrace_Version = HiTrace_Version(0);
193}
194#[repr(transparent)]
195/// Enumerates the HiTrace version numbers.
196///
197///
198/// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
199///
200///
201/// Available since API-level: 12
202#[cfg(feature = "api-12")]
203#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
204#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
205pub struct HiTrace_Version(pub ::core::ffi::c_uint);
206#[cfg(feature = "api-12")]
207#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
208impl ::core::ops::BitOr<HiTrace_Flag> for HiTrace_Flag {
209 type Output = Self;
210 #[inline]
211 fn bitor(self, other: Self) -> Self {
212 HiTrace_Flag(self.0 | other.0)
213 }
214}
215#[cfg(feature = "api-12")]
216#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
217impl ::core::ops::BitOrAssign for HiTrace_Flag {
218 #[inline]
219 fn bitor_assign(&mut self, rhs: HiTrace_Flag) {
220 self.0 |= rhs.0;
221 }
222}
223#[cfg(feature = "api-12")]
224#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
225impl ::core::ops::BitAnd<HiTrace_Flag> for HiTrace_Flag {
226 type Output = Self;
227 #[inline]
228 fn bitand(self, other: Self) -> Self {
229 HiTrace_Flag(self.0 & other.0)
230 }
231}
232#[cfg(feature = "api-12")]
233#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
234impl ::core::ops::BitAndAssign for HiTrace_Flag {
235 #[inline]
236 fn bitand_assign(&mut self, rhs: HiTrace_Flag) {
237 self.0 &= rhs.0;
238 }
239}
240#[cfg(feature = "api-12")]
241#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
242impl HiTrace_Flag {
243 /// Default flag.
244 ///
245 ///
246 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
247 ///
248 ///
249 /// Available since API-level: 12
250 #[cfg(feature = "api-12")]
251 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
252 pub const HITRACE_FLAG_DEFAULT: HiTrace_Flag = HiTrace_Flag(0);
253 /// Both synchronous and asynchronous calls are traced. By default, only synchronous calls are traced.
254 ///
255 ///
256 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
257 ///
258 ///
259 /// Available since API-level: 12
260 #[cfg(feature = "api-12")]
261 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
262 pub const HITRACE_FLAG_INCLUDE_ASYNC: HiTrace_Flag = HiTrace_Flag(1);
263 /// No spans are created. By default, spans are created.
264 ///
265 ///
266 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
267 ///
268 ///
269 /// Available since API-level: 12
270 #[cfg(feature = "api-12")]
271 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
272 pub const HITRACE_FLAG_DONOT_CREATE_SPAN: HiTrace_Flag = HiTrace_Flag(2);
273 /// Trace points are automatically added to spans. By default, no trace point is added.
274 ///
275 ///
276 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
277 ///
278 ///
279 /// Available since API-level: 12
280 #[cfg(feature = "api-12")]
281 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
282 pub const HITRACE_FLAG_TP_INFO: HiTrace_Flag = HiTrace_Flag(4);
283 /// Information about the start and end of the trace task is not printed. By default, information about the
284 /// start and end of the trace task is printed.
285 ///
286 ///
287 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
288 ///
289 ///
290 /// Available since API-level: 12
291 #[cfg(feature = "api-12")]
292 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
293 pub const HITRACE_FLAG_NO_BE_INFO: HiTrace_Flag = HiTrace_Flag(8);
294 /// The ID is not added to the log. By default, the ID is added to the log.
295 ///
296 ///
297 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
298 ///
299 ///
300 /// Available since API-level: 12
301 #[cfg(feature = "api-12")]
302 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
303 pub const HITRACE_FLAG_DONOT_ENABLE_LOG: HiTrace_Flag = HiTrace_Flag(16);
304 /// Tracing is triggered by faults.
305 ///
306 ///
307 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
308 ///
309 ///
310 /// Available since API-level: 12
311 #[cfg(feature = "api-12")]
312 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
313 pub const HITRACE_FLAG_FAULT_TRIGGER: HiTrace_Flag = HiTrace_Flag(32);
314 /// Trace points are added only for call chain trace between devices.
315 /// By default, device-to-device trace points are not added.
316 ///
317 ///
318 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
319 ///
320 ///
321 /// Available since API-level: 12
322 #[cfg(feature = "api-12")]
323 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
324 pub const HITRACE_FLAG_D2D_TP_INFO: HiTrace_Flag = HiTrace_Flag(64);
325}
326#[repr(transparent)]
327/// Enumerates the HiTrace flags.
328///
329///
330/// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
331///
332///
333/// Available since API-level: 12
334#[cfg(feature = "api-12")]
335#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
336#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
337pub struct HiTrace_Flag(pub ::core::ffi::c_uint);
338/// Enumerates the HiTrace trace point types.
339///
340///
341/// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
342///
343///
344/// Available since API-level: 12
345#[cfg(feature = "api-12")]
346#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
347#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
348#[repr(u32)]
349#[non_exhaustive]
350pub enum HiTrace_Tracepoint_Type {
351 /// CS trace point.
352 ///
353 ///
354 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
355 ///
356 ///
357 /// Available since API-level: 12
358 #[cfg(feature = "api-12")]
359 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
360 HITRACE_TP_CS = 0,
361 /// CR trace point.
362 ///
363 ///
364 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
365 ///
366 ///
367 /// Available since API-level: 12
368 #[cfg(feature = "api-12")]
369 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
370 HITRACE_TP_CR = 1,
371 /// SS trace point.
372 ///
373 ///
374 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
375 ///
376 ///
377 /// Available since API-level: 12
378 #[cfg(feature = "api-12")]
379 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
380 HITRACE_TP_SS = 2,
381 /// SR trace point.
382 ///
383 ///
384 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
385 ///
386 ///
387 /// Available since API-level: 12
388 #[cfg(feature = "api-12")]
389 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
390 HITRACE_TP_SR = 3,
391 /// General trace point.
392 ///
393 ///
394 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
395 ///
396 ///
397 /// Available since API-level: 12
398 #[cfg(feature = "api-12")]
399 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
400 HITRACE_TP_GENERAL = 4,
401}
402#[cfg(feature = "api-12")]
403#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
404impl HiTrace_Communication_Mode {
405 /// Default communication mode.
406 ///
407 ///
408 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
409 ///
410 ///
411 /// Available since API-level: 12
412 #[cfg(feature = "api-12")]
413 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
414 pub const HITRACE_CM_DEFAULT: HiTrace_Communication_Mode = HiTrace_Communication_Mode(0);
415 /// Inter-thread communication.
416 ///
417 ///
418 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
419 ///
420 ///
421 /// Available since API-level: 12
422 #[cfg(feature = "api-12")]
423 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
424 pub const HITRACE_CM_THREAD: HiTrace_Communication_Mode = HiTrace_Communication_Mode(1);
425 /// Inter-process communication.
426 ///
427 ///
428 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
429 ///
430 ///
431 /// Available since API-level: 12
432 #[cfg(feature = "api-12")]
433 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
434 pub const HITRACE_CM_PROCESS: HiTrace_Communication_Mode = HiTrace_Communication_Mode(2);
435 /// Inter-device communication.
436 ///
437 ///
438 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
439 ///
440 ///
441 /// Available since API-level: 12
442 #[cfg(feature = "api-12")]
443 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
444 pub const HITRACE_CM_DEVICE: HiTrace_Communication_Mode = HiTrace_Communication_Mode(3);
445}
446#[repr(transparent)]
447/// Enumerates the HiTrace communication modes.
448///
449///
450/// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
451///
452///
453/// Available since API-level: 12
454#[cfg(feature = "api-12")]
455#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
456#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
457pub struct HiTrace_Communication_Mode(pub ::core::ffi::c_uint);
458#[cfg(feature = "api-19")]
459#[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
460impl HiTrace_Output_Level {
461 /// Output level only for debug usage.
462 ///
463 ///
464 /// Available since API-level: 19
465 #[cfg(feature = "api-19")]
466 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
467 pub const HITRACE_LEVEL_DEBUG: HiTrace_Output_Level = HiTrace_Output_Level(0);
468 /// Output level for log version usage.
469 ///
470 ///
471 /// Available since API-level: 19
472 #[cfg(feature = "api-19")]
473 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
474 pub const HITRACE_LEVEL_INFO: HiTrace_Output_Level = HiTrace_Output_Level(1);
475 /// Output level for log version usage, with higher priority than HITRACE_LEVEL_INFO.
476 ///
477 ///
478 /// Available since API-level: 19
479 #[cfg(feature = "api-19")]
480 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
481 pub const HITRACE_LEVEL_CRITICAL: HiTrace_Output_Level = HiTrace_Output_Level(2);
482 /// Output level for nolog version usage.
483 ///
484 ///
485 /// Available since API-level: 19
486 #[cfg(feature = "api-19")]
487 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
488 pub const HITRACE_LEVEL_COMMERCIAL: HiTrace_Output_Level = HiTrace_Output_Level(3);
489 /// Output level for range limit.
490 ///
491 ///
492 /// Available since API-level: 19
493 #[cfg(feature = "api-19")]
494 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
495 pub const HITRACE_LEVEL_MAX: HiTrace_Output_Level = HiTrace_Output_Level(3);
496}
497#[repr(transparent)]
498/// Enumerates the HiTrace output levels. The output level threshold system parameter determines
499/// the minimum output trace.
500///
501///
502/// Available since API-level: 19
503#[cfg(feature = "api-19")]
504#[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
505#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
506pub struct HiTrace_Output_Level(pub ::core::ffi::c_uint);
507/// Defines a <b>HiTraceId</b> instance.
508///
509/// HiTraceId
510///
511///
512/// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
513///
514///
515/// Available since API-level: 12
516#[cfg(feature = "api-12")]
517#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
518#[repr(C)]
519#[derive(Debug, Copy, Clone)]
520pub struct HiTraceId {
521 pub _bitfield_align_1: [u64; 0],
522 pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>,
523}
524#[cfg(feature = "api-12")]
525#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
526impl HiTraceId {
527 #[inline]
528 pub fn valid(&self) -> u64 {
529 unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u64) }
530 }
531 #[inline]
532 pub fn set_valid(&mut self, val: u64) {
533 unsafe {
534 let val: u64 = ::core::mem::transmute(val);
535 self._bitfield_1.set(0usize, 1u8, val as u64)
536 }
537 }
538 #[inline]
539 pub unsafe fn valid_raw(this: *const Self) -> u64 {
540 unsafe {
541 ::core::mem::transmute(<__BindgenBitfieldUnit<[u8; 16usize]>>::raw_get(
542 ::core::ptr::addr_of!((*this)._bitfield_1),
543 0usize,
544 1u8,
545 ) as u64)
546 }
547 }
548 #[inline]
549 pub unsafe fn set_valid_raw(this: *mut Self, val: u64) {
550 unsafe {
551 let val: u64 = ::core::mem::transmute(val);
552 <__BindgenBitfieldUnit<[u8; 16usize]>>::raw_set(
553 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
554 0usize,
555 1u8,
556 val as u64,
557 )
558 }
559 }
560 #[inline]
561 pub fn ver(&self) -> u64 {
562 unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 3u8) as u64) }
563 }
564 #[inline]
565 pub fn set_ver(&mut self, val: u64) {
566 unsafe {
567 let val: u64 = ::core::mem::transmute(val);
568 self._bitfield_1.set(1usize, 3u8, val as u64)
569 }
570 }
571 #[inline]
572 pub unsafe fn ver_raw(this: *const Self) -> u64 {
573 unsafe {
574 ::core::mem::transmute(<__BindgenBitfieldUnit<[u8; 16usize]>>::raw_get(
575 ::core::ptr::addr_of!((*this)._bitfield_1),
576 1usize,
577 3u8,
578 ) as u64)
579 }
580 }
581 #[inline]
582 pub unsafe fn set_ver_raw(this: *mut Self, val: u64) {
583 unsafe {
584 let val: u64 = ::core::mem::transmute(val);
585 <__BindgenBitfieldUnit<[u8; 16usize]>>::raw_set(
586 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
587 1usize,
588 3u8,
589 val as u64,
590 )
591 }
592 }
593 #[inline]
594 pub fn chainId(&self) -> u64 {
595 unsafe { ::core::mem::transmute(self._bitfield_1.get(4usize, 60u8) as u64) }
596 }
597 #[inline]
598 pub fn set_chainId(&mut self, val: u64) {
599 unsafe {
600 let val: u64 = ::core::mem::transmute(val);
601 self._bitfield_1.set(4usize, 60u8, val as u64)
602 }
603 }
604 #[inline]
605 pub unsafe fn chainId_raw(this: *const Self) -> u64 {
606 unsafe {
607 ::core::mem::transmute(<__BindgenBitfieldUnit<[u8; 16usize]>>::raw_get(
608 ::core::ptr::addr_of!((*this)._bitfield_1),
609 4usize,
610 60u8,
611 ) as u64)
612 }
613 }
614 #[inline]
615 pub unsafe fn set_chainId_raw(this: *mut Self, val: u64) {
616 unsafe {
617 let val: u64 = ::core::mem::transmute(val);
618 <__BindgenBitfieldUnit<[u8; 16usize]>>::raw_set(
619 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
620 4usize,
621 60u8,
622 val as u64,
623 )
624 }
625 }
626 #[inline]
627 pub fn flags(&self) -> u64 {
628 unsafe { ::core::mem::transmute(self._bitfield_1.get(64usize, 12u8) as u64) }
629 }
630 #[inline]
631 pub fn set_flags(&mut self, val: u64) {
632 unsafe {
633 let val: u64 = ::core::mem::transmute(val);
634 self._bitfield_1.set(64usize, 12u8, val as u64)
635 }
636 }
637 #[inline]
638 pub unsafe fn flags_raw(this: *const Self) -> u64 {
639 unsafe {
640 ::core::mem::transmute(<__BindgenBitfieldUnit<[u8; 16usize]>>::raw_get(
641 ::core::ptr::addr_of!((*this)._bitfield_1),
642 64usize,
643 12u8,
644 ) as u64)
645 }
646 }
647 #[inline]
648 pub unsafe fn set_flags_raw(this: *mut Self, val: u64) {
649 unsafe {
650 let val: u64 = ::core::mem::transmute(val);
651 <__BindgenBitfieldUnit<[u8; 16usize]>>::raw_set(
652 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
653 64usize,
654 12u8,
655 val as u64,
656 )
657 }
658 }
659 #[inline]
660 pub fn spanId(&self) -> u64 {
661 unsafe { ::core::mem::transmute(self._bitfield_1.get(76usize, 26u8) as u64) }
662 }
663 #[inline]
664 pub fn set_spanId(&mut self, val: u64) {
665 unsafe {
666 let val: u64 = ::core::mem::transmute(val);
667 self._bitfield_1.set(76usize, 26u8, val as u64)
668 }
669 }
670 #[inline]
671 pub unsafe fn spanId_raw(this: *const Self) -> u64 {
672 unsafe {
673 ::core::mem::transmute(<__BindgenBitfieldUnit<[u8; 16usize]>>::raw_get(
674 ::core::ptr::addr_of!((*this)._bitfield_1),
675 76usize,
676 26u8,
677 ) as u64)
678 }
679 }
680 #[inline]
681 pub unsafe fn set_spanId_raw(this: *mut Self, val: u64) {
682 unsafe {
683 let val: u64 = ::core::mem::transmute(val);
684 <__BindgenBitfieldUnit<[u8; 16usize]>>::raw_set(
685 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
686 76usize,
687 26u8,
688 val as u64,
689 )
690 }
691 }
692 #[inline]
693 pub fn parentSpanId(&self) -> u64 {
694 unsafe { ::core::mem::transmute(self._bitfield_1.get(102usize, 26u8) as u64) }
695 }
696 #[inline]
697 pub fn set_parentSpanId(&mut self, val: u64) {
698 unsafe {
699 let val: u64 = ::core::mem::transmute(val);
700 self._bitfield_1.set(102usize, 26u8, val as u64)
701 }
702 }
703 #[inline]
704 pub unsafe fn parentSpanId_raw(this: *const Self) -> u64 {
705 unsafe {
706 ::core::mem::transmute(<__BindgenBitfieldUnit<[u8; 16usize]>>::raw_get(
707 ::core::ptr::addr_of!((*this)._bitfield_1),
708 102usize,
709 26u8,
710 ) as u64)
711 }
712 }
713 #[inline]
714 pub unsafe fn set_parentSpanId_raw(this: *mut Self, val: u64) {
715 unsafe {
716 let val: u64 = ::core::mem::transmute(val);
717 <__BindgenBitfieldUnit<[u8; 16usize]>>::raw_set(
718 ::core::ptr::addr_of_mut!((*this)._bitfield_1),
719 102usize,
720 26u8,
721 val as u64,
722 )
723 }
724 }
725 #[inline]
726 pub fn new_bitfield_1(
727 valid: u64,
728 ver: u64,
729 chainId: u64,
730 flags: u64,
731 spanId: u64,
732 parentSpanId: u64,
733 ) -> __BindgenBitfieldUnit<[u8; 16usize]> {
734 let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default();
735 __bindgen_bitfield_unit.set(0usize, 1u8, {
736 let valid: u64 = unsafe { ::core::mem::transmute(valid) };
737 valid as u64
738 });
739 __bindgen_bitfield_unit.set(1usize, 3u8, {
740 let ver: u64 = unsafe { ::core::mem::transmute(ver) };
741 ver as u64
742 });
743 __bindgen_bitfield_unit.set(4usize, 60u8, {
744 let chainId: u64 = unsafe { ::core::mem::transmute(chainId) };
745 chainId as u64
746 });
747 __bindgen_bitfield_unit.set(64usize, 12u8, {
748 let flags: u64 = unsafe { ::core::mem::transmute(flags) };
749 flags as u64
750 });
751 __bindgen_bitfield_unit.set(76usize, 26u8, {
752 let spanId: u64 = unsafe { ::core::mem::transmute(spanId) };
753 spanId as u64
754 });
755 __bindgen_bitfield_unit.set(102usize, 26u8, {
756 let parentSpanId: u64 = unsafe { ::core::mem::transmute(parentSpanId) };
757 parentSpanId as u64
758 });
759 __bindgen_bitfield_unit
760 }
761}
762extern "C" {
763 /// Starts tracing of a process.
764 ///
765 /// This API starts tracing, creates a <b>HiTraceId</b> instance, and sets it to the TLS of the calling thread.
766 /// This API works only when it is called for the first time.
767 ///
768 /// # Arguments
769 ///
770 /// * `name` - Pointer to a process name.
771 ///
772 /// * `flags` - Trace flag.
773 ///
774 /// # Returns
775 ///
776 /// * Returns the created <b>HiTraceId</b> instance.
777 ///
778 ///
779 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
780 ///
781 ///
782 /// Available since API-level: 12
783 #[cfg(feature = "api-12")]
784 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
785 pub fn OH_HiTrace_BeginChain(
786 name: *const ::core::ffi::c_char,
787 flags: ::core::ffi::c_int,
788 ) -> HiTraceId;
789 /// Ends tracing and clears the <b>HiTraceId</b> instance of the calling thread from the TLS.
790 ///
791 ///
792 ///
793 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
794 ///
795 ///
796 /// Available since API-level: 12
797 #[cfg(feature = "api-12")]
798 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
799 pub fn OH_HiTrace_EndChain();
800 /// Obtains the trace ID of the calling thread from the TLS.
801 ///
802 ///
803 ///
804 /// # Returns
805 ///
806 /// * Returns the trace ID of the calling thread. If the calling thread does not have a trace ID,
807 /// an invalid trace ID is returned.
808 ///
809 ///
810 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
811 ///
812 ///
813 /// Available since API-level: 12
814 #[cfg(feature = "api-12")]
815 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
816 pub fn OH_HiTrace_GetId() -> HiTraceId;
817 /// Sets the trace ID of the calling thread. If the ID is invalid, no operation is performed.
818 ///
819 /// This API sets a <b>HiTraceId</b> instance to the TLS of the calling thread.
820 ///
821 /// # Arguments
822 ///
823 /// * `id` - Trace ID to set.
824 ///
825 ///
826 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
827 ///
828 ///
829 /// Available since API-level: 12
830 #[cfg(feature = "api-12")]
831 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
832 pub fn OH_HiTrace_SetId(id: *const HiTraceId);
833 /// Clears the trace ID of the calling thread and invalidates it.
834 ///
835 /// This API clears the <b>HiTraceId</b> instance in the TLS of the calling thread.
836 ///
837 ///
838 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
839 ///
840 ///
841 /// Available since API-level: 12
842 #[cfg(feature = "api-12")]
843 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
844 pub fn OH_HiTrace_ClearId();
845 /// Creates a span ID based on the trace ID of the calling thread.
846 ///
847 /// This API generates a new span and corresponding <b>HiTraceId</b> instance based on the <b>HiTraceId</b>
848 /// instance in the TLS of the calling thread.
849 ///
850 ///
851 /// # Returns
852 ///
853 /// * Returns a valid span ID. If span creation is not allowed, the ID of the calling thread is traced.
854 ///
855 ///
856 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
857 ///
858 ///
859 /// Available since API-level: 12
860 #[cfg(feature = "api-12")]
861 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
862 pub fn OH_HiTrace_CreateSpan() -> HiTraceId;
863 /// Prints HiTrace information, including the trace ID.
864 ///
865 /// This API prints trace point information, including the communication mode, trace point type, timestamp, and span.
866 ///
867 /// # Arguments
868 ///
869 /// * `mode` - Communication mode for the trace point.
870 ///
871 /// * `type` - Trace point type.
872 ///
873 /// * `id` - Trace ID.
874 ///
875 /// * `fmt` - Custom information to print.
876 ///
877 ///
878 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
879 ///
880 ///
881 /// Available since API-level: 12
882 #[cfg(feature = "api-12")]
883 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
884 pub fn OH_HiTrace_Tracepoint(
885 mode: HiTrace_Communication_Mode,
886 type_: HiTrace_Tracepoint_Type,
887 id: *const HiTraceId,
888 fmt: *const ::core::ffi::c_char,
889 ...
890 );
891 /// Initializes a <b>HiTraceId</b> structure.
892 ///
893 /// # Arguments
894 ///
895 /// * `id` - ID of the <b>HiTraceId</b> structure to be initialized.
896 ///
897 ///
898 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
899 ///
900 ///
901 /// Available since API-level: 12
902 #[cfg(feature = "api-12")]
903 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
904 pub fn OH_HiTrace_InitId(id: *mut HiTraceId);
905 /// Creates a <b>HiTraceId</b> structure based on a byte array.
906 ///
907 /// # Arguments
908 ///
909 /// * `id` - ID of the <b>HiTraceId</b> structure to be created.
910 ///
911 /// * `pIdArray` - Byte array.
912 ///
913 /// * `len` - Length of the byte array.
914 ///
915 ///
916 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
917 ///
918 ///
919 /// Available since API-level: 12
920 #[cfg(feature = "api-12")]
921 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
922 pub fn OH_HiTrace_IdFromBytes(id: *mut HiTraceId, pIdArray: *const u8, len: ::core::ffi::c_int);
923 /// Checks whether a <b>HiTraceId</b> instance is valid.
924 ///
925 ///
926 /// # Arguments
927 ///
928 /// * `id` - <b>HiTraceId</b> instance to check.
929 ///
930 /// # Returns
931 ///
932 /// * Returns <b>true</b> if the <b>HiTraceId</b> instance is valid; returns <b>false</b> otherwise.
933 ///
934 ///
935 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
936 ///
937 ///
938 /// Available since API-level: 12
939 #[cfg(feature = "api-12")]
940 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
941 pub fn OH_HiTrace_IsIdValid(id: *const HiTraceId) -> bool;
942 /// Checks whether the specified trace flag in a <b>HiTraceId</b> instance is enabled.
943 ///
944 ///
945 /// # Arguments
946 ///
947 /// * `id` - <b>HiTraceId</b> instance to check.
948 ///
949 /// * `flag` - Specified trace flag.
950 ///
951 /// # Returns
952 ///
953 /// * Returns <b>true</b> if the specified trace flag is enabled; returns <b>false</b> otherwise.
954 ///
955 ///
956 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
957 ///
958 ///
959 /// Available since API-level: 12
960 #[cfg(feature = "api-12")]
961 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
962 pub fn OH_HiTrace_IsFlagEnabled(id: *const HiTraceId, flag: HiTrace_Flag) -> bool;
963 /// Enables the specified trace flag in a <b>HiTraceId</b> instance.
964 ///
965 ///
966 /// # Arguments
967 ///
968 /// * `id` - <b>HiTraceId</b> instance for which you want to enable the specified trace flag.
969 ///
970 /// * `flag` - Specified trace flag.
971 ///
972 ///
973 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
974 ///
975 ///
976 /// Available since API-level: 12
977 #[cfg(feature = "api-12")]
978 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
979 pub fn OH_HiTrace_EnableFlag(id: *const HiTraceId, flag: HiTrace_Flag);
980 /// Obtains the trace flag set in a <b>HiTraceId</b> instance.
981 ///
982 /// # Arguments
983 ///
984 /// * `id` - <b>HiTraceId</b> instance.
985 ///
986 ///
987 /// # Returns
988 ///
989 /// * Returns the trace flag set in the specified <b>HiTraceId</b> instance.
990 ///
991 ///
992 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
993 ///
994 ///
995 /// Available since API-level: 12
996 #[cfg(feature = "api-12")]
997 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
998 pub fn OH_HiTrace_GetFlags(id: *const HiTraceId) -> ::core::ffi::c_int;
999 /// Sets the trace flag for a <b>HiTraceId</b> instance.
1000 ///
1001 /// # Arguments
1002 ///
1003 /// * `id` - <b>HiTraceId</b> instance.
1004 ///
1005 /// * `flags` - Trace flag to set.
1006 ///
1007 ///
1008 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1009 ///
1010 ///
1011 /// Available since API-level: 12
1012 #[cfg(feature = "api-12")]
1013 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1014 pub fn OH_HiTrace_SetFlags(id: *mut HiTraceId, flags: ::core::ffi::c_int);
1015 /// Obtains the trace chain ID.
1016 ///
1017 /// # Arguments
1018 ///
1019 /// * `id` - <b>HiTraceId</b> instance for which you want to obtain the trace chain ID.
1020 ///
1021 ///
1022 /// # Returns
1023 ///
1024 /// * Returns the trace chain ID of the specified <b>HiTraceId</b> instance.
1025 ///
1026 ///
1027 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1028 ///
1029 ///
1030 /// Available since API-level: 12
1031 #[cfg(feature = "api-12")]
1032 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1033 pub fn OH_HiTrace_GetChainId(id: *const HiTraceId) -> u64;
1034 /// Sets the trace chain ID to a <b>HiTraceId</b> instance
1035 ///
1036 /// # Arguments
1037 ///
1038 /// * `id` - <b>HiTraceId</b> instance.
1039 ///
1040 /// * `chainId` - Trace chain ID to set.
1041 ///
1042 ///
1043 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1044 ///
1045 ///
1046 /// Available since API-level: 12
1047 #[cfg(feature = "api-12")]
1048 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1049 pub fn OH_HiTrace_SetChainId(id: *mut HiTraceId, chainId: u64);
1050 /// Obtains the span ID in a <b>HiTraceId</b> instance.
1051 ///
1052 /// # Arguments
1053 ///
1054 /// * `id` - <b>HiTraceId</b> instance for which you want to obtain the span ID.
1055 ///
1056 ///
1057 /// # Returns
1058 ///
1059 /// * Returns the span ID in the specified <b>HiTraceId</b> instance.
1060 ///
1061 ///
1062 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1063 ///
1064 ///
1065 /// Available since API-level: 12
1066 #[cfg(feature = "api-12")]
1067 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1068 pub fn OH_HiTrace_GetSpanId(id: *const HiTraceId) -> u64;
1069 /// Sets the span ID in a <b>HiTraceId</b> instance.
1070 ///
1071 /// # Arguments
1072 ///
1073 /// * `id` - <b>HiTraceId</b> instance for which you want to set the span ID.
1074 ///
1075 /// * `spanId` - Span ID to set.
1076 ///
1077 ///
1078 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1079 ///
1080 ///
1081 /// Available since API-level: 12
1082 #[cfg(feature = "api-12")]
1083 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1084 pub fn OH_HiTrace_SetSpanId(id: *mut HiTraceId, spanId: u64);
1085 /// Obtains the parent span ID in a <b>HiTraceId</b> instance.
1086 ///
1087 /// # Arguments
1088 ///
1089 /// * `id` - <b>HiTraceId</b> instance for which you want to obtain the parent span ID.
1090 ///
1091 ///
1092 /// # Returns
1093 ///
1094 /// * Returns the parent span ID in the specified <b>HiTraceId</b> instance.
1095 ///
1096 ///
1097 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1098 ///
1099 ///
1100 /// Available since API-level: 12
1101 #[cfg(feature = "api-12")]
1102 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1103 pub fn OH_HiTrace_GetParentSpanId(id: *const HiTraceId) -> u64;
1104 /// Sets the parent span ID in a <b>HiTraceId</b> instance.
1105 ///
1106 /// # Arguments
1107 ///
1108 /// * `id` - <b>HiTraceId</b> instance for which you want to set the parent span ID.
1109 ///
1110 /// * `parentSpanId` - Parent span ID to set.
1111 ///
1112 ///
1113 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1114 ///
1115 ///
1116 /// Available since API-level: 12
1117 #[cfg(feature = "api-12")]
1118 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1119 pub fn OH_HiTrace_SetParentSpanId(id: *mut HiTraceId, parentSpanId: u64);
1120 /// Converts a <b>HiTraceId</b> instance into a byte array for caching or communication.
1121 ///
1122 /// # Arguments
1123 ///
1124 /// * `id` - <b>HiTraceId</b> instance to be converted.
1125 ///
1126 /// * `pIdArray` - Byte array.
1127 ///
1128 /// * `len` - Length of the byte array.
1129 ///
1130 ///
1131 /// # Returns
1132 ///
1133 /// * Returns the length of the byte array after conversion.
1134 ///
1135 ///
1136 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1137 ///
1138 ///
1139 /// Available since API-level: 12
1140 #[cfg(feature = "api-12")]
1141 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
1142 pub fn OH_HiTrace_IdToBytes(
1143 id: *const HiTraceId,
1144 pIdArray: *mut u8,
1145 len: ::core::ffi::c_int,
1146 ) -> ::core::ffi::c_int;
1147 /// Marks the start of a synchronous trace task.
1148 ///
1149 /// The <b>OH_HiTrace_StartTrace</b> and <b>OH_HiTrace_FinishTrace</b> APIs must be used in pairs.
1150 /// The two APIs can be used in nested mode. The stack data structure is used for matching during trace data parsing.
1151 ///
1152 /// # Arguments
1153 ///
1154 /// * `name` - Name of a trace task.
1155 ///
1156 ///
1157 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1158 ///
1159 /// Available since API-level: 10
1160 pub fn OH_HiTrace_StartTrace(name: *const ::core::ffi::c_char);
1161 /// Marks the end of a synchronous trace task.
1162 ///
1163 /// This API must be used with <b>OH_HiTrace_StartTrace</b> in pairs. During trace data parsing, the system matches
1164 /// it with the <b>OH_HiTrace_StartTrace</b> API recently invoked in the service process.
1165 ///
1166 ///
1167 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1168 ///
1169 /// Available since API-level: 10
1170 pub fn OH_HiTrace_FinishTrace();
1171 /// Marks the start of an asynchronous trace task.
1172 ///
1173 /// This API is called to implement performance trace in asynchronous manner. The start and end of an asynchronous
1174 /// trace task do not occur in sequence. Therefore, a unique <b>taskId</b> is required to ensure proper data parsing.
1175 /// It is passed as an input parameter for the asynchronous API.
1176 /// This API is used with <b>OH_HiTrace_FinishAsyncTrace</b> in pairs. The two APIs that have the same name and
1177 /// task ID together form an asynchronous timeslice trace task.
1178 /// If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be
1179 /// performed multiple times concurrently, different task IDs must be specified in <b>OH_HiTrace_StartTrace</b>.
1180 /// If the trace tasks with the same name are not performed at the same time, the same taskId can be used.
1181 ///
1182 /// # Arguments
1183 ///
1184 /// * `name` - Name of the asynchronous trace task.
1185 ///
1186 /// * `taskId` - ID of the asynchronous trace task. The start and end of an asynchronous trace task do not occur in
1187 /// sequence. Therefore, the start and end of an asynchronous trace need to be matched based on the task name and the
1188 /// unique task ID together.
1189 ///
1190 ///
1191 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1192 ///
1193 /// Available since API-level: 10
1194 pub fn OH_HiTrace_StartAsyncTrace(name: *const ::core::ffi::c_char, taskId: i32);
1195 /// Marks the end of an asynchronous trace task.
1196 ///
1197 /// This API is called in the callback function after an asynchronous trace is complete.
1198 /// It is used with <b>OH_HiTrace_StartAsyncTrace</b> in pairs. Its name and task ID must be the same as those of
1199 /// <b>OH_HiTrace_StartAsyncTrace</b>.
1200 ///
1201 /// # Arguments
1202 ///
1203 /// * `name` - Name of the asynchronous trace task.
1204 ///
1205 /// * `taskId` - ID of the asynchronous trace task. The start and end of an asynchronous trace task do not occur in
1206 /// sequence. Therefore, the start and end of an asynchronous trace need to be matched based on the task name and the
1207 /// unique task ID together.
1208 ///
1209 ///
1210 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1211 ///
1212 /// Available since API-level: 10
1213 pub fn OH_HiTrace_FinishAsyncTrace(name: *const ::core::ffi::c_char, taskId: i32);
1214 /// Traces the value change of an integer variable based on its name.
1215 ///
1216 /// This API can be executed for multiple times to trace the value change of a given integer variable at different
1217 /// time points.
1218 ///
1219 /// # Arguments
1220 ///
1221 /// * `name` - Name of the integer variable. It does not need to be the same as the real variable name.
1222 ///
1223 /// * `count` - Integer value. Generally, an integer variable can be passed.
1224 ///
1225 ///
1226 /// Required System Capabilities: SystemCapability.HiviewDFX.HiTrace
1227 ///
1228 /// Available since API-level: 10
1229 pub fn OH_HiTrace_CountTrace(name: *const ::core::ffi::c_char, count: i64);
1230 /// Marks the start of a synchronous trace task with output level control.
1231 ///
1232 /// The <b>OH_HiTrace_StartTraceEx</b> and <b>OH_HiTrace_FinishTraceEx</b> APIs must be used in pairs.
1233 /// The two APIs can be used in nested mode. The stack data structure is used for matching during trace data parsing.
1234 ///
1235 /// # Arguments
1236 ///
1237 /// * `level` - Trace output priority level.
1238 ///
1239 /// * `name` - Name of the synchronous trace task.
1240 ///
1241 /// * `customArgs` - key=value pair, multiple pairs use comma as separator.
1242 ///
1243 /// Available since API-level: 19
1244 #[cfg(feature = "api-19")]
1245 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
1246 pub fn OH_HiTrace_StartTraceEx(
1247 level: HiTrace_Output_Level,
1248 name: *const ::core::ffi::c_char,
1249 customArgs: *const ::core::ffi::c_char,
1250 );
1251 /// Marks the end of a synchronous trace task with output level control.
1252 ///
1253 /// This API must be used with <b>OH_HiTrace_StartTraceEx</b> in pairs. The two APIs, which have the same level,
1254 /// form an synchronous timeslice trace task.
1255 /// During trace data parsing, the system matches it with the most recent <b>OH_HiTrace_StartTraceEx</b> API
1256 /// invocation in the service process.
1257 ///
1258 /// # Arguments
1259 ///
1260 /// * `level` - Trace output priority level.
1261 ///
1262 /// Available since API-level: 19
1263 #[cfg(feature = "api-19")]
1264 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
1265 pub fn OH_HiTrace_FinishTraceEx(level: HiTrace_Output_Level);
1266 /// Marks the start of an asynchronous trace task with output level control.
1267 ///
1268 /// This API is called to implement performance trace in asynchronous manner. The start and end of an asynchronous
1269 /// trace task do not occur in sequence. Therefore, a unique <b>taskId</b> is required to ensure proper data parsing.
1270 /// It is passed as an input parameter for the asynchronous API.
1271 /// This API is used with <b>OH_HiTrace_FinishAsyncTraceEx</b> in pairs. The two APIs, which have the same level,
1272 /// name, and task ID, form an asynchronous timeslice trace task.
1273 /// If customCategory is specified, the trace slice will be grouped and displayed together with other trace slices
1274 /// with the same customCategory.
1275 /// If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be
1276 /// performed multiple times concurrently, different task IDs must be specified in <b>OH_HiTrace_StartAsyncTraceEx</b>.
1277 /// If the trace tasks with the same name are not performed at the same time, the same taskId can be used.
1278 /// Different processes's taskId do not interfere.
1279 ///
1280 /// # Arguments
1281 ///
1282 /// * `level` - Trace output priority level.
1283 ///
1284 /// * `name` - Name of the asynchronous trace task.
1285 ///
1286 /// * `taskId` - ID of the asynchronous trace task.
1287 ///
1288 /// * `customCategory` - Label used to aggregate the asynchronous trace.
1289 ///
1290 /// * `customArgs` - key=value pair, multiple pairs use comma as separator.
1291 ///
1292 /// Available since API-level: 19
1293 #[cfg(feature = "api-19")]
1294 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
1295 pub fn OH_HiTrace_StartAsyncTraceEx(
1296 level: HiTrace_Output_Level,
1297 name: *const ::core::ffi::c_char,
1298 taskId: i32,
1299 customCategory: *const ::core::ffi::c_char,
1300 customArgs: *const ::core::ffi::c_char,
1301 );
1302 /// Marks the end of an asynchronous trace task with output level control.
1303 ///
1304 /// This API is called in the callback function after an asynchronous trace is complete.
1305 /// It is used with <b>OH_HiTrace_StartAsyncTraceEx</b> in pairs. Its level, name, and task ID must be
1306 /// the same as those of <b>OH_HiTrace_StartAsyncTraceEx</b>.
1307 ///
1308 /// # Arguments
1309 ///
1310 /// * `level` - Trace output priority level.
1311 ///
1312 /// * `name` - Name of the asynchronous trace task.
1313 ///
1314 /// * `taskId` - ID of the asynchronous trace task.
1315 ///
1316 /// Available since API-level: 19
1317 #[cfg(feature = "api-19")]
1318 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
1319 pub fn OH_HiTrace_FinishAsyncTraceEx(
1320 level: HiTrace_Output_Level,
1321 name: *const ::core::ffi::c_char,
1322 taskId: i32,
1323 );
1324 /// Traces the value change of an integer variable based on its name with output level control.
1325 ///
1326 /// This API can be executed for multiple times to trace the value change of a given integer variable at different
1327 /// time points.
1328 ///
1329 /// # Arguments
1330 ///
1331 /// * `level` - Trace output priority level.
1332 ///
1333 /// * `name` - Name of the integer variable. It does not need to be the same as the real variable name.
1334 ///
1335 /// * `count` - Integer value. Generally, an integer variable can be passed.
1336 ///
1337 /// Available since API-level: 19
1338 #[cfg(feature = "api-19")]
1339 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
1340 pub fn OH_HiTrace_CountTraceEx(
1341 level: HiTrace_Output_Level,
1342 name: *const ::core::ffi::c_char,
1343 count: i64,
1344 );
1345 /// Get the trace output status of the calling process.
1346 ///
1347 ///
1348 /// # Returns
1349 ///
1350 /// * Returns whether the calling process is allowed to output trace.
1351 ///
1352 /// Available since API-level: 19
1353 #[cfg(feature = "api-19")]
1354 #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
1355 pub fn OH_HiTrace_IsTraceEnabled() -> bool;
1356}