• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "hitracechain_c_wrapper.h"
17 
18 #include "hitracechain_inner.h"
19 
HiTraceChainTracepointExWrapper(int mode,int type,const HiTraceIdStruct * pId,const char * fmt,...)20 void HiTraceChainTracepointExWrapper(int mode, int type, const HiTraceIdStruct* pId, const char* fmt, ...)
21 {
22     va_list args;
23     va_start(args, fmt);
24     HiTraceChainTracepointInner(mode, type, pId, 0, fmt, args);
25     va_end(args);
26     return;
27 }
28 
HiTraceChainTracepointExWithDomainWrapper(int mode,int type,const HiTraceIdStruct * pId,unsigned int domain,const char * fmt,...)29 void HiTraceChainTracepointExWithDomainWrapper(int mode, int type, const HiTraceIdStruct* pId,
30     unsigned int domain, const char* fmt, ...)
31 {
32     va_list args;
33     va_start(args, fmt);
34     HiTraceChainTracepointInner(mode, type, pId, domain, fmt, args);
35     va_end(args);
36     return;
37 }
38 
HiTraceChainIsFlagEnabledWrapper(const HiTraceIdStruct * pId,int flag)39 int HiTraceChainIsFlagEnabledWrapper(const HiTraceIdStruct* pId, int flag)
40 {
41     return HiTraceChainIsFlagEnabled(pId, flag);
42 }
43 
HiTraceChainEnableFlagWrapper(HiTraceIdStruct * pId,int flag)44 void HiTraceChainEnableFlagWrapper(HiTraceIdStruct* pId, int flag)
45 {
46     HiTraceChainEnableFlag(pId, flag);
47 }
48 
HiTraceChainIsValidWrapper(const HiTraceIdStruct * pId)49 int HiTraceChainIsValidWrapper(const HiTraceIdStruct* pId)
50 {
51     return HiTraceChainIsValid(pId);
52 }
53 
HiTraceChainSetFlagsWrapper(HiTraceIdStruct * pId,int flags)54 void HiTraceChainSetFlagsWrapper(HiTraceIdStruct* pId, int flags)
55 {
56     HiTraceChainSetFlags(pId, flags);
57 }
58 
HiTraceChainGetFlagsWrapper(const HiTraceIdStruct * pId)59 int HiTraceChainGetFlagsWrapper(const HiTraceIdStruct* pId)
60 {
61     return HiTraceChainGetFlags(pId);
62 }
63 
HiTraceChainSetChainIdWrapper(HiTraceIdStruct * pId,uint64_t chainId)64 void HiTraceChainSetChainIdWrapper(HiTraceIdStruct* pId, uint64_t chainId)
65 {
66     HiTraceChainSetChainId(pId, chainId);
67 }
68 
HiTraceChainGetChainIdWrapper(const HiTraceIdStruct * pId)69 uint64_t HiTraceChainGetChainIdWrapper(const HiTraceIdStruct* pId)
70 {
71     return HiTraceChainGetChainId(pId);
72 }
73 
HiTraceChainSetSpanIdWrapper(HiTraceIdStruct * pId,uint64_t spanId)74 void HiTraceChainSetSpanIdWrapper(HiTraceIdStruct* pId, uint64_t spanId)
75 {
76     HiTraceChainSetSpanId(pId, spanId);
77 }
78 
HiTraceChainGetSpanIdWrapper(const HiTraceIdStruct * pId)79 uint64_t HiTraceChainGetSpanIdWrapper(const HiTraceIdStruct* pId)
80 {
81     return HiTraceChainGetSpanId(pId);
82 }
83 
HiTraceChainSetParentSpanIdWrapper(HiTraceIdStruct * pId,uint64_t parentSpanId)84 void HiTraceChainSetParentSpanIdWrapper(HiTraceIdStruct* pId, uint64_t parentSpanId)
85 {
86     HiTraceChainSetParentSpanId(pId, parentSpanId);
87 }
88 
HiTraceChainGetParentSpanIdWrapper(const HiTraceIdStruct * pId)89 uint64_t HiTraceChainGetParentSpanIdWrapper(const HiTraceIdStruct* pId)
90 {
91     return HiTraceChainGetParentSpanId(pId);
92 }
93 
HiTraceChainIdToBytesWrapper(const HiTraceIdStruct * pId,uint8_t * pIdArray,int len)94 int HiTraceChainIdToBytesWrapper(const HiTraceIdStruct* pId, uint8_t* pIdArray, int len)
95 {
96     return HiTraceChainIdToBytes(pId, pIdArray, len);
97 }
98 
HiTraceChainBytesToIdWrapper(const uint8_t * pIdArray,int len)99 HiTraceIdStruct HiTraceChainBytesToIdWrapper(const uint8_t* pIdArray, int len)
100 {
101     return HiTraceChainBytesToId(pIdArray, len);
102 }