diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md index f3f6df0eb652d6fd93e8d4dae2ebf9ae58c816e8..cf146746b25096da1d2c1b4e648024ed0b0374f7 100644 --- a/en/device-dev/subsystems/Readme-EN.md +++ b/en/device-dev/subsystems/Readme-EN.md @@ -103,7 +103,7 @@ - [DFX Overview](subsys-dfx-overview.md) - [HiLog Development](subsys-dfx-hilog-rich.md) - [HiLog\_Lite Development](subsys-dfx-hilog-lite.md) - - [HiTrace Development](subsys-dfx-hitrace.md) + - [HiTraceChain Development](subsys-dfx-hitracechain.md) - [HiCollie Development](subsys-dfx-hicollie.md) - HiSysEvent Development - [HiSysEvent Logging Configuration](subsys-dfx-hisysevent-logging-config.md) diff --git a/en/device-dev/subsystems/subsys-dfx-hitrace.md b/en/device-dev/subsystems/subsys-dfx-hitracechain.md similarity index 90% rename from en/device-dev/subsystems/subsys-dfx-hitrace.md rename to en/device-dev/subsystems/subsys-dfx-hitracechain.md index 4cc3bd9bb90269b74e103659360807d709cfb55b..6639011302e78ba1e9931b24362c5790c24dd4a3 100644 --- a/en/device-dev/subsystems/subsys-dfx-hitrace.md +++ b/en/device-dev/subsystems/subsys-dfx-hitracechain.md @@ -1,18 +1,20 @@ -# HiTrace Development +# HiTraceChain Development ## Overview -HiTrace tracks the call chain with the same **traceid** throughout the inter-device, inter-process, and inter-thread service processes. It associates and displays the call relationship and various output information during the entire process, helping you analyze and locate faults and optimize the system. +HiTraceChain tracks the call chain with the same **traceid** throughout the inter-device, inter-process, and inter-thread service processes. It associates and displays the call relationship and various output information during the entire process, helping you analyze and locate faults and optimize the system. ## Use Cases -HiTrace can be used for the following purposes: +HiTraceChain can be used for the following purposes: + +- Associates and reports service process information \(such as logs and events\) on the device. + +- Displays and analyzes reported information on the cloud to facilitate fault location. -- Associates and reports service process information \(such as logs and events\) on the device. -- Displays and analyzes reported information on the cloud to facilitate fault location. - Works with the IDE to debug the detailed service process and time consumption distribution for system optimization. - **Figure 1** Use cases of HiTrace + **Figure 1** Use cases of HiTraceChain ![](figure/use-cases-of-hitrace.png "use-cases-of-hitrace") @@ -33,9 +35,9 @@ HiTrace can be used for the following purposes: ## Available APIs -HiTrace provides C++ and C APIs. The upper-layer services mainly use HiTrace to start and stop call chain tracing. +HiTraceChain provides C++ and C APIs. The upper-layer services mainly use HiTraceChain to start and stop call chain tracing. -HiTrace is implemented at layer C. It works by transferring **traceid** throughout the service calling process. Before service processing, HiTrace sets **traceid** in the thread local storage \(TLS\) of the calling thread. During service processing, HiTrace obtains **traceid** from the contextual TLS of the calling thread and automatically adds it to the log and event information. After service processing is complete, HiTrace clears **traceid** from the TLS of the calling thread. +HiTraceChain is implemented at layer C. It works by transferring **traceid** throughout the service calling process. Before service processing, HiTraceChain sets **traceid** in the thread local storage \(TLS\) of the calling thread. During service processing, HiTraceChain obtains **traceid** from the contextual TLS of the calling thread and automatically adds it to the log and event information. After service processing is complete, HiTraceChain clears **traceid** from the TLS of the calling thread. ### Java, C++, and C APIs @@ -56,7 +58,7 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug

API

-

HiTrace

+

HiTraceChain

@@ -67,42 +69,42 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug

HiTraceId Begin(const std::string& name, int flags)

-

HiTraceIdStruct HiTraceBegin(const char* name, int flags)

+

HiTraceIdStruct HiTraceChainBegin(const char* name, int flags)

void End(const HiTraceId& id)

-

void HiTraceEnd(const HiTraceIdStruct* pId)

+

void HiTraceChainEnd(const HiTraceIdStruct* pId)

HiTraceId GetId();

-

HiTraceIdStruct HiTraceGetId()

+

HiTraceIdStruct HiTraceChainGetId()

void SetId(const HiTraceId& id)

-

void HiTraceSetId(const HiTraceIdStruct* pId)

+

void HiTraceChainSetId(const HiTraceIdStruct* pId)

void ClearId()

-

void HiTraceClearId()

+

void HiTraceChainClearId()

HiTraceId CreateSpan()

-

HiTraceIdStruct HiTraceCreateSpan()

+

HiTraceIdStruct HiTraceChainCreateSpan()

void Tracepoint(HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...)

-

void HiTraceTracepoint(HiTraceTracepointType type, const HiTraceIdStruct* pId, const char* fmt, ...)

+

void HiTraceChainTracepoint(HiTraceTracepointType type, const HiTraceIdStruct* pId, const char* fmt, ...)

void Tracepoint(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...)

-

void HiTraceTracepointEx(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceIdStruct* pId, const char* fmt, ...)

+

void HiTraceChainTracepointEx(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceIdStruct* pId, const char* fmt, ...)

HiTraceId

@@ -122,72 +124,72 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug

HiTraceId();

-

void HiTraceInitId(HiTraceIdStruct* pId)

+

void HiTraceChainInitId(HiTraceIdStruct* pId)

HiTraceId(const uint8_t* pIdArray, int len)

-

HiTraceIdStruct HiTraceBytesToId(const uint8_t* pIdArray, int len)

+

HiTraceIdStruct HiTraceChainBytesToId(const uint8_t* pIdArray, int len)

bool IsValid()

-

int HiTraceIsValid(const HiTraceIdStruct* pId)

+

int HiTraceChainIsValid(const HiTraceIdStruct* pId)

bool IsFlagEnabled(HiTraceFlag flag)

-

int HiTraceIsFlagEnabled(const HiTraceIdStruct* pId, HiTraceFlag flag)

+

int HiTraceChainIsFlagEnabled(const HiTraceIdStruct* pId, HiTraceFlag flag)

void EnableFlag(HiTraceFlag flag)

-

void HiTraceEnableFlag(HiTraceIdStruct* pId, HiTraceFlag flag)

+

void HiTraceChainEnableFlag(HiTraceIdStruct* pId, HiTraceFlag flag)

int GetFlags()

-

int HiTraceGetFlags(const HiTraceIdStruct* pId)

+

int HiTraceChainGetFlags(const HiTraceIdStruct* pId)

void SetFlags(int flags)

-

void HiTraceSetFlags(HiTraceIdStruct* pId, int flags)

+

void HiTraceChainSetFlags(HiTraceIdStruct* pId, int flags)

uint64_t GetChainId()

-

uint64_t HiTraceGetChainId(const HiTraceIdStruct* pId)

+

uint64_t HiTraceChainGetChainId(const HiTraceIdStruct* pId)

void SetChainId(uint64_t chainId)

-

void HiTraceSetChainId(HiTraceIdStruct* pId, uint64_t chainId)

+

void HiTraceChainSetChainId(HiTraceIdStruct* pId, uint64_t chainId)

uint64_t GetSpanId()

-

uint64_t HiTraceGetSpanId(const HiTraceIdStruct* pId)

+

uint64_t HiTraceChainGetSpanId(const HiTraceIdStruct* pId)

void SetSpanId(uint64_t spanId)

-

void HiTraceSetSpanId(HiTraceIdStruct* pId, uint64_t spanId)

+

void HiTraceChainSetSpanId(HiTraceIdStruct* pId, uint64_t spanId)

uint64_t GetParentSpanId()

-

uint64_t HiTraceGetParentSpanId(const HiTraceIdStruct* pId)

+

uint64_t HiTraceChainGetParentSpanId(const HiTraceIdStruct* pId)

void SetParentSpanId(uint64_t parentSpanId)

-

void HiTraceSetParentSpanId(HiTraceIdStruct* pId, uint64_t parentSpanId)

+

void HiTraceChainSetParentSpanId(HiTraceIdStruct* pId, uint64_t parentSpanId)

int ToBytes(uint8_t* pIdArray, int len)

-

int HiTraceIdToBytes(const HiTraceIdStruct* pId, uint8_t* pIdArray, int len)

+

int HiTraceChainIdToBytes(const HiTraceIdStruct* pId, uint8_t* pIdArray, int len)

@@ -206,7 +208,7 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug -

HiTrace

+

HiTraceChain

@@ -217,7 +219,7 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug

HiTraceId Begin(const std::string& name, int flags)

-

Starts HiTrace, generates a HiTraceId object, and sets it in the TLS of the calling thread.

+

Starts HiTraceChain, generates a HiTraceId object, and sets it in the TLS of the calling thread.

Input arguments:

@@ -226,7 +228,7 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug

void End(const HiTraceId& id)

-

Stops HiTrace based on the HiTraceId object returned by the Begin API, and clears the HiTraceId object in the TLS of the calling thread.

+

Stops HiTraceChain based on the HiTraceId object returned by the Begin API, and clears the HiTraceId object in the TLS of the calling thread.

Input arguments:

Output arguments: none

@@ -268,7 +270,7 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug

void Tracepoint(HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...)

-

Outputs HiTrace call chain information based on the information type. The information includes the timestamp and HiTraceId object information of the span.

+

Outputs HiTraceChain call chain information based on the information type. The information includes the timestamp and HiTraceId object information of the span.

Input arguments:

@@ -278,7 +280,7 @@ HiTrace is implemented at layer C. It works by transferring **traceid** throug

void Tracepoint(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...)

-

Outputs HiTrace call chain information based on the communication mode and information type. The information includes the timestamp and HiTraceId object information of the span.

+

Outputs HiTraceChain call chain information based on the communication mode and information type. The information includes the timestamp and HiTraceId object information of the span.

Input arguments: