From 725d1fa473b436a9646fbc6dadf19313126bc448 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 14 Jul 2023 09:28:43 +0800 Subject: [PATCH] update docs Signed-off-by: shawn_he --- .../reference/native-apis/trace_8h.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 en/application-dev/reference/native-apis/trace_8h.md diff --git a/en/application-dev/reference/native-apis/trace_8h.md b/en/application-dev/reference/native-apis/trace_8h.md new file mode 100644 index 0000000000..56f88fea16 --- /dev/null +++ b/en/application-dev/reference/native-apis/trace_8h.md @@ -0,0 +1,76 @@ +# trace.h + + +## Overview + +Defines APIs of the HiTraceMeter module for performance trace. + +Example + +Synchronous time slice trace event: + + +``` +OH_HiTrace_StartTrace("hitraceTest"); +OH_HiTrace_FinishTrace(); +``` + +Output: + + +``` +<...>-1668 (----—) [003] .... 135.059377: tracing_mark_write: B|1668|H:hitraceTest +<...>-1668 (----—) [003] .... 135.059415: tracing_mark_write: E|1668| +``` + +Asynchronous time slice trace event: + + +``` +OH_HiTrace_StartAsyncTrace("hitraceTest", 123); +OH_HiTrace_FinishAsyncTrace("hitraceTest", 123); +``` + +Output: + + +``` +<...>-2477 (----—) [001] .... 396.427165: tracing_mark_write: S|2477|H:hitraceTest 123 +<...>-2477 (----—) [001] .... 396.427196: tracing_mark_write: F|2477|H:hitraceTest 123 +``` + +Integer value trace event: + + +``` +OH_HiTrace_CountTrace("hitraceTest", 500); +``` + +Output: + + +``` +<...>-2638 (----—) [002] .... 458.904382: tracing_mark_write: C|2638|H:hitraceTest 500 +``` + +**Since** + +10 + +**Related Modules** + +[Hitrace](_hitrace.md) + + +## Summary + + +### Functions + +| Name| Description| +| -------- | -------- | +| [OH_HiTrace_StartTrace](_hitrace.md#oh_hitrace_starttrace) (const char \*name) | Marks the start of a synchronous trace.| +| [OH_HiTrace_FinishTrace](_hitrace.md#oh_hitrace_finishtrace) (void) | Marks the end of a synchronous trace.| +| [OH_HiTrace_StartAsyncTrace](_hitrace.md#oh_hitrace_startasynctrace) (const char \*name, int32_t taskId) | Marks the start of an asynchronous trace.| +| [OH_HiTrace_FinishAsyncTrace](_hitrace.md#oh_hitrace_finishasynctrace) (const char \*name, int32_t taskId) | Marks the end of an asynchronous trace.| +| [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.| -- GitLab