mirror of
https://gitee.com/openharmony/hiviewdfx_hiview
synced 2024-11-23 17:19:57 +00:00
add HIVIEWDFX_UE events
Signed-off-by: lyj_love_code <liangyujian2@huawei.com>
This commit is contained in:
parent
874197bca8
commit
97502ab453
@ -23,7 +23,8 @@
|
||||
"ram": "",
|
||||
"hisysevent_config": [
|
||||
"//base/hiviewdfx/hiview/hisysevent.yaml",
|
||||
"//base/hiviewdfx/hiview/hiviewdfx.yaml",
|
||||
"//base/hiviewdfx/hiview/hisysevent/hiviewdfx.yaml",
|
||||
"//base/hiviewdfx/hiview/hisysevent/hiviewdfx_ue.yaml",
|
||||
"//base/hiviewdfx/hiview/kernel_vendor.yaml",
|
||||
"//base/hiviewdfx/hiview/plugins/performance/hisysevent.yaml"
|
||||
],
|
||||
|
29
hisysevent/hiviewdfx_ue.yaml
Normal file
29
hisysevent/hiviewdfx_ue.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
domain: HIVIEWDFX_UE
|
||||
|
||||
APP_USAGE:
|
||||
__BASE: {type: STATISTIC, level: CRITICAL, tag: usageStats, desc: application usage statistics}
|
||||
PACKAGE: {type: STRING, desc: package name}
|
||||
VERSION: {type: STRING, desc: version name}
|
||||
USAGE: {type: UINT32, desc: usage duration}
|
||||
DATE: {type: STRING, desc: usage date}
|
||||
TOTAL_START_NUM: {type: UINT32, desc: total start number}
|
||||
|
||||
SYS_USAGE:
|
||||
__BASE: {type: STATISTIC, level: CRITICAL, tag: usageStats, desc: system usage statistics}
|
||||
START: {type: UINT64, desc: start time}
|
||||
END: {type: UINT64, desc: end time}
|
||||
POWER: {type: UINT64, desc: power_on duration}
|
||||
RUNNING: {type: UINT64, desc: running duration}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -14,10 +14,12 @@
|
||||
*/
|
||||
#include "app_usage_event.h"
|
||||
|
||||
#include "hiview_logger.h"
|
||||
#include "usage_event_common.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace HiviewDFX {
|
||||
DEFINE_LOG_TAG("AppUsageEvent");
|
||||
using namespace AppUsageEventSpace;
|
||||
|
||||
AppUsageEvent::AppUsageEvent(const std::string &name, HiSysEvent::EventType type)
|
||||
@ -32,12 +34,34 @@ AppUsageEvent::AppUsageEvent(const std::string &name, HiSysEvent::EventType type
|
||||
|
||||
void AppUsageEvent::Report()
|
||||
{
|
||||
HiSysEventWrite(HiSysEvent::Domain::HIVIEWDFX, this->eventName_, this->eventType_,
|
||||
ReportDFX();
|
||||
ReportDFXUE();
|
||||
}
|
||||
|
||||
void AppUsageEvent::ReportDFX()
|
||||
{
|
||||
auto ret = HiSysEventWrite(HiSysEvent::Domain::HIVIEWDFX, this->eventName_, this->eventType_,
|
||||
KEY_OF_PACKAGE, this->paramMap_[KEY_OF_PACKAGE].GetString(),
|
||||
KEY_OF_VERSION, this->paramMap_[KEY_OF_VERSION].GetString(),
|
||||
KEY_OF_USAGE, this->paramMap_[KEY_OF_USAGE].GetUint64(),
|
||||
KEY_OF_DATE, this->paramMap_[KEY_OF_DATE].GetString(),
|
||||
KEY_OF_START_NUM, this->paramMap_[KEY_OF_START_NUM].GetUint32());
|
||||
if (ret != 0) {
|
||||
HIVIEW_LOGW("failed to report app usage event, ret=%{public}d", ret);
|
||||
}
|
||||
}
|
||||
|
||||
void AppUsageEvent::ReportDFXUE()
|
||||
{
|
||||
auto ret = HiSysEventWrite(DomainSpace::HIVIEWDFX_UE_DOMAIN, this->eventName_, this->eventType_,
|
||||
KEY_OF_PACKAGE, this->paramMap_[KEY_OF_PACKAGE].GetString(),
|
||||
KEY_OF_VERSION, this->paramMap_[KEY_OF_VERSION].GetString(),
|
||||
KEY_OF_USAGE, this->paramMap_[KEY_OF_USAGE].GetUint64(),
|
||||
KEY_OF_DATE, this->paramMap_[KEY_OF_DATE].GetString(),
|
||||
KEY_OF_START_NUM, this->paramMap_[KEY_OF_START_NUM].GetUint32());
|
||||
if (ret != 0) {
|
||||
HIVIEW_LOGW("failed to report app usage event, ret=%{public}d", ret);
|
||||
}
|
||||
}
|
||||
} // namespace HiviewDFX
|
||||
} // namespace OHOS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -24,6 +24,10 @@ class AppUsageEvent : public LoggerEvent {
|
||||
public:
|
||||
AppUsageEvent(const std::string &name, HiSysEvent::EventType type);
|
||||
void Report() override;
|
||||
|
||||
private:
|
||||
void ReportDFX();
|
||||
void ReportDFXUE();
|
||||
};
|
||||
} // namespace HiviewDFX
|
||||
} // namespace OHOS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -26,6 +26,10 @@ class SysUsageEvent : public LoggerEvent {
|
||||
public:
|
||||
SysUsageEvent(const std::string &name, HiSysEvent::EventType type);
|
||||
void Report() override;
|
||||
|
||||
private:
|
||||
void ReportDFX();
|
||||
void ReportDFXUE();
|
||||
};
|
||||
} // namespace HiviewDFX
|
||||
} // namespace OHOS
|
||||
|
@ -14,10 +14,12 @@
|
||||
*/
|
||||
#include "sys_usage_event.h"
|
||||
|
||||
#include "hiview_logger.h"
|
||||
#include "usage_event_common.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace HiviewDFX {
|
||||
DEFINE_LOG_TAG("SysUsageEvent");
|
||||
using namespace SysUsageEventSpace;
|
||||
|
||||
SysUsageEvent::SysUsageEvent(const std::string &name, HiSysEvent::EventType type)
|
||||
@ -31,12 +33,32 @@ SysUsageEvent::SysUsageEvent(const std::string &name, HiSysEvent::EventType type
|
||||
|
||||
void SysUsageEvent::Report()
|
||||
{
|
||||
HiSysEventWrite(HiSysEvent::Domain::HIVIEWDFX, this->eventName_, this->eventType_,
|
||||
ReportDFX();
|
||||
ReportDFXUE();
|
||||
}
|
||||
|
||||
void SysUsageEvent::ReportDFX()
|
||||
{
|
||||
auto ret = HiSysEventWrite(HiSysEvent::Domain::HIVIEWDFX, this->eventName_, this->eventType_,
|
||||
KEY_OF_START, this->paramMap_[KEY_OF_START].GetUint64(),
|
||||
KEY_OF_END, this->paramMap_[KEY_OF_END].GetUint64(),
|
||||
KEY_OF_POWER, this->paramMap_[KEY_OF_POWER].GetUint64(),
|
||||
KEY_OF_RUNNING, this->paramMap_[KEY_OF_RUNNING].GetUint64()
|
||||
);
|
||||
KEY_OF_RUNNING, this->paramMap_[KEY_OF_RUNNING].GetUint64());
|
||||
if (ret != 0) {
|
||||
HIVIEW_LOGW("failed to report sys usage event, ret=%{public}d", ret);
|
||||
}
|
||||
}
|
||||
|
||||
void SysUsageEvent::ReportDFXUE()
|
||||
{
|
||||
auto ret = HiSysEventWrite(DomainSpace::HIVIEWDFX_UE_DOMAIN, this->eventName_, this->eventType_,
|
||||
KEY_OF_START, this->paramMap_[KEY_OF_START].GetUint64(),
|
||||
KEY_OF_END, this->paramMap_[KEY_OF_END].GetUint64(),
|
||||
KEY_OF_POWER, this->paramMap_[KEY_OF_POWER].GetUint64(),
|
||||
KEY_OF_RUNNING, this->paramMap_[KEY_OF_RUNNING].GetUint64());
|
||||
if (ret != 0) {
|
||||
HIVIEW_LOGW("failed to report sys usage event, ret=%{public}d", ret);
|
||||
}
|
||||
}
|
||||
} // namespace HiviewDFX
|
||||
} // namespace OHOS
|
||||
|
@ -43,6 +43,9 @@ namespace SysUsageDbSpace {
|
||||
const std::string SYS_USAGE_TABLE = "sys_usage";
|
||||
const std::string LAST_SYS_USAGE_TABLE = "last_sys_usage";
|
||||
}
|
||||
namespace DomainSpace {
|
||||
constexpr char HIVIEWDFX_UE_DOMAIN[] = "HIVIEWDFX_UE";
|
||||
}
|
||||
} // namespace HiviewDFX
|
||||
} // namespace OHOS
|
||||
#endif // HIVIEW_PLUGINS_USAGE_EVENT_REPORT_SREVICE_USAGE_EVENT_COMMON_H
|
||||
|
Loading…
Reference in New Issue
Block a user