1 /*
2 * Copyright (c) 2025 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 "res_sched_hisysevent_report_util.h"
17 #include "hisysevent_c.h"
18
19 namespace OHOS {
20 namespace ResourceSchedule {
21 namespace ResCommonUtil {
HiSysAbnormalErrReport(const std::string & moduleName,const std::string & funcName,const std::string & errInfo)22 void HiSysAbnormalErrReport(const std::string& moduleName, const std::string& funcName, const std::string& errInfo)
23 {
24 struct HiSysEventParam params[] = {
25 {
26 .name = "MODULE_NAME",
27 .t = HISYSEVENT_STRING,
28 .v = { .s = const_cast<char *>(moduleName.c_str()) },
29 .arraySize = 0
30 },
31 {
32 .name = "FUNC_NAME",
33 .t = HISYSEVENT_STRING,
34 .v = { .s = const_cast<char *>(funcName.c_str()) },
35 .arraySize = 0
36 },
37 {
38 .name = "ERR_INFO",
39 .t = HISYSEVENT_STRING,
40 .v = { .s = const_cast<char *>(errInfo.c_str()) },
41 .arraySize = 0
42 },
43 };
44
45 OH_HiSysEvent_Write(
46 "RSS",
47 "ABNORMAL_ERR",
48 HISYSEVENT_STATISTIC,
49 params,
50 sizeof(params)/sizeof(params[0])
51 );
52 }
53 }
54 } // namespace ResourceSchedule
55 } // namespace OHOS
56