• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# trace.h
2
3
4## Overview
5
6Defines APIs of the HiTraceMeter module for performance trace.
7
8Example
9
10Synchronous time slice trace event:
11
12
13```
14OH_HiTrace_StartTrace("hitraceTest");
15OH_HiTrace_FinishTrace();
16```
17
18Output:
19
20
21```
22<...>-1668 (----—) [003] .... 135.059377: tracing_mark_write: B|1668|H:hitraceTest
23<...>-1668 (----—) [003] .... 135.059415: tracing_mark_write: E|1668|
24```
25
26Asynchronous time slice trace event:
27
28
29```
30OH_HiTrace_StartAsyncTrace("hitraceTest", 123);
31OH_HiTrace_FinishAsyncTrace("hitraceTest", 123);
32```
33
34Output:
35
36
37```
38<...>-2477 (----—) [001] .... 396.427165: tracing_mark_write: S|2477|H:hitraceTest 123
39<...>-2477 (----—) [001] .... 396.427196: tracing_mark_write: F|2477|H:hitraceTest 123
40```
41
42Integer value trace event:
43
44
45```
46OH_HiTrace_CountTrace("hitraceTest", 500);
47```
48
49Output:
50
51
52```
53<...>-2638 (----—) [002] .... 458.904382: tracing_mark_write: C|2638|H:hitraceTest 500
54```
55
56**Since**
57
5810
59
60**Related Modules**
61
62[Hitrace](_hitrace.md)
63
64
65## Summary
66
67
68### Functions
69
70| Name| Description|
71| -------- | -------- |
72| [OH_HiTrace_StartTrace](_hitrace.md#oh_hitrace_starttrace) (const char \*name) | Marks the start of a synchronous trace.|
73| [OH_HiTrace_FinishTrace](_hitrace.md#oh_hitrace_finishtrace) (void) | Marks the end of a synchronous trace.|
74| [OH_HiTrace_StartAsyncTrace](_hitrace.md#oh_hitrace_startasynctrace) (const char \*name, int32_t taskId) | Marks the start of an asynchronous trace.|
75| [OH_HiTrace_FinishAsyncTrace](_hitrace.md#oh_hitrace_finishasynctrace) (const char \*name, int32_t taskId) | Marks the end of an asynchronous trace.|
76| [OH_HiTrace_CountTrace](_hitrace.md#oh_hitrace_counttrace) (const char \*name, int64_t count) | Traces the value change of an integer variable based on its name.|
77