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_EVENT_TAG 85 27 #define MAX_LENGTH_OF_TIME_ZONE 6 28 29 struct HiSysEventRecord { 30 char domain[MAX_LENGTH_OF_EVENT_DOMAIN]; 31 char eventName[MAX_LENGTH_OF_EVENT_NAME]; 32 int type; 33 uint64_t time; 34 char tz[MAX_LENGTH_OF_TIME_ZONE]; 35 int64_t pid; 36 int64_t tid; 37 int64_t uid; 38 uint64_t traceId; 39 uint64_t spandId; 40 uint64_t pspanId; 41 int traceFlag; 42 char* level; 43 char* tag; 44 char* jsonStr; 45 }; 46 typedef struct HiSysEventRecord HiSysEventRecordC; 47 48 void OH_HiSysEvent_GetParamNames( 49 const HiSysEventRecordC* record, char*** params, size_t* len); 50 int OH_HiSysEvent_GetParamInt64Value( 51 const HiSysEventRecordC* record, const char* name, int64_t* value); 52 int OH_HiSysEvent_GetParamUint64Value( 53 const HiSysEventRecordC* record, const char* name, uint64_t* value); 54 int OH_HiSysEvent_GetParamDoubleValue( 55 const HiSysEventRecordC* record, const char* name, double* value); 56 int OH_HiSysEvent_GetParamStringValue( 57 const HiSysEventRecordC* record, const char* name, char** value); 58 int OH_HiSysEvent_GetParamInt64Values( 59 const HiSysEventRecordC* record, const char* name, int64_t** value, size_t* len); 60 int OH_HiSysEvent_GetParamUint64Values( 61 const HiSysEventRecordC* record, const char* name, uint64_t** value, size_t* len); 62 int OH_HiSysEvent_GetParamDoubleValues( 63 const HiSysEventRecordC* record, const char* name, double** value, size_t* len); 64 int OH_HiSysEvent_GetParamStringValues( 65 const HiSysEventRecordC* record, const char* name, char*** value, size_t* len); 66 #ifdef __cplusplus 67 } 68 #endif 69 #endif // HISYSEVENT_RECORD_C_H 70