1 /* 2 * Copyright (c) 2022 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 #ifndef HISYSEVENT_RECORD_C_H 16 #define HISYSEVENT_RECORD_C_H 17 18 #include "hisysevent_c.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #define MAX_LENGTH_OF_EVENT_DOMAIN 17 25 #define MAX_LENGTH_OF_EVENT_NAME 33 26 #define MAX_LENGTH_OF_TIME_ZONE 6 27 28 struct HiSysEventRecord { 29 char domain[MAX_LENGTH_OF_EVENT_DOMAIN]; 30 char eventName[MAX_LENGTH_OF_EVENT_NAME]; 31 HiSysEventEventType type; 32 uint64_t time; 33 char tz[MAX_LENGTH_OF_TIME_ZONE]; 34 int64_t pid; 35 int64_t tid; 36 int64_t uid; 37 uint64_t traceId; 38 uint64_t spandId; 39 uint64_t pspanId; 40 int traceFlag; 41 char* level; 42 char* tag; 43 char* jsonStr; 44 }; 45 typedef struct HiSysEventRecord HiSysEventRecord; 46 47 void OH_HiSysEvent_GetParamNames( 48 const HiSysEventRecord& record, char*** params, size_t& len); 49 int OH_HiSysEvent_GetParamInt64Value( 50 const HiSysEventRecord& record, const char* name, int64_t& value); 51 int OH_HiSysEvent_GetParamUint64Value( 52 const HiSysEventRecord& record, const char* name, uint64_t& value); 53 int OH_HiSysEvent_GetParamDoubleValue( 54 const HiSysEventRecord& record, const char* name, double& value); 55 int OH_HiSysEvent_GetParamStringValue( 56 const HiSysEventRecord& record, const char* name, char** value); 57 int OH_HiSysEvent_GetParamInt64Values( 58 const HiSysEventRecord& record, const char* name, int64_t** value, size_t& len); 59 int OH_HiSysEvent_GetParamUint64Values( 60 const HiSysEventRecord& record, const char* name, uint64_t** value, size_t& len); 61 int OH_HiSysEvent_GetParamDoubleValues( 62 const HiSysEventRecord& record, const char* name, double** value, size_t& len); 63 int OH_HiSysEvent_GetParamStringValues( 64 const HiSysEventRecord& record, const char* name, char*** value, size_t& len); 65 #ifdef __cplusplus 66 } 67 #endif 68 #endif // HISYSEVENT_RECORD_C_H 69