mirror of
https://github.com/openharmony/miscservices_pasteboard.git
synced 2026-07-19 17:13:31 -04:00
Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>
Changes to be committed:
This commit is contained in:
+1
-12
@@ -48,18 +48,7 @@ INITIALIZATION_FAULT:
|
||||
TIME_CONSUMING_STATISTIC:
|
||||
__BASE: {type: STATISTIC, level: MINOR, desc: The event is api visit statistic }
|
||||
PASTEBOARD_STATE: {type: STRING, desc: Pasteboard state }
|
||||
DATA_LEVLE: {type: STRING, desc: Data level }
|
||||
TIME_CONSUMING_LEVEL_ONE: {type: INT32, desc: The counts of time consuming level one }
|
||||
TIME_CONSUMING_LEVEL_TWO: {type: INT32, desc: The counts of time consuming level two }
|
||||
TIME_CONSUMING_LEVEL_THREE: {type: INT32, desc: The counts of time consuming level three }
|
||||
TIME_CONSUMING_LEVEL_FOUR: {type: INT32, desc: The counts of time consuming level four }
|
||||
TIME_CONSUMING_LEVEL_FIVE: {type: INT32, desc: The counts of time consuming level five }
|
||||
TIME_CONSUMING_LEVEL_SIX: {type: INT32, desc: The counts of time consuming level six }
|
||||
TIME_CONSUMING_LEVEL_SEVEN: {type: INT32, desc: The counts of time consuming level seven }
|
||||
TIME_CONSUMING_LEVEL_EIGHT: {type: INT32, desc: The counts of time consuming level eight }
|
||||
TIME_CONSUMING_LEVEL_NINE: {type: INT32, desc: The counts of time consuming level nine }
|
||||
TIME_CONSUMING_LEVEL_TEN: {type: INT32, desc: The counts of time consuming level ten }
|
||||
TIME_CONSUMING_LEVEL_ELEVEN: {type: INT32, desc: The counts of time consuming level eleven }
|
||||
CONSUMING_DATA: {type: STRING, desc: Consuming data }
|
||||
|
||||
PASTEBOARD_BEHAVIOUR:
|
||||
__BASE: {type: BEHAVIOR, level: MINOR, desc: The event is behaviour record }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2022 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
|
||||
@@ -40,6 +40,15 @@ CalculateTimeConsuming::~CalculateTimeConsuming()
|
||||
|
||||
int CalculateTimeConsuming::CalculateData(size_t calPasteboardData) const
|
||||
{
|
||||
constexpr int M_BTYE = 1024;
|
||||
constexpr int TC_ZERO_KB = 0;
|
||||
constexpr int TC_HUNDRED_KB = 100;
|
||||
constexpr int TC_FIVE_HUNDRED = 500;
|
||||
constexpr int TC_ONE_MB = 1;
|
||||
constexpr int TC_FIVE_MB = 5;
|
||||
constexpr int TC_TEN_MB = 10;
|
||||
constexpr int TC_FIFTY_MB = 50;
|
||||
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "CalculateData() enter");
|
||||
if (calPasteboardData % M_BTYE == 0) {
|
||||
if (calPasteboardData >= TC_ZERO_KB && calPasteboardData < TC_HUNDRED_KB) {
|
||||
@@ -66,6 +75,18 @@ int CalculateTimeConsuming::CalculateData(size_t calPasteboardData) const
|
||||
|
||||
int CalculateTimeConsuming::CalculateTime(uint64_t time)
|
||||
{
|
||||
constexpr int FIVE_HUNDRED_MS = 500;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_ZERO = 0;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_ONE = 1;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_TWO = 2;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_THREE = 3;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_FOUR = 4;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_FIVE = 5;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_SIX = 6;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_SEVEN = 7;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_EIGHT = 8;
|
||||
constexpr int PER_FIVE_HUNDRED_MS_NINE = 9;
|
||||
|
||||
uint64_t timeCosuming = time % FIVE_HUNDRED_MS;
|
||||
switch (timeCosuming) {
|
||||
case PER_FIVE_HUNDRED_MS_ZERO:
|
||||
@@ -95,6 +116,9 @@ int CalculateTimeConsuming::CalculateTime(uint64_t time)
|
||||
|
||||
uint64_t CalculateTimeConsuming::GetCurrentTimeMicros()
|
||||
{
|
||||
constexpr int64_t SEC_TO_MILLISEC = 1000;
|
||||
constexpr int64_t MICROSEC_TO_MILLISEC = 1000;
|
||||
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "GetCurrentTimeMicros() start");
|
||||
struct timeval tv = { 0, 0 };
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2022 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
|
||||
@@ -34,32 +34,6 @@ private:
|
||||
int pasteboardData_;
|
||||
int pasteboardState_;
|
||||
uint64_t lastTime_{ 0 };
|
||||
|
||||
static const inline int M_BTYE = 1024;
|
||||
|
||||
static const inline int TC_ZERO_KB = 0;
|
||||
static const inline int TC_HUNDRED_KB = 100;
|
||||
static const inline int TC_FIVE_HUNDRED = 500;
|
||||
|
||||
static const inline int TC_ONE_MB = 1;
|
||||
static const inline int TC_FIVE_MB = 5;
|
||||
static const inline int TC_TEN_MB = 10;
|
||||
static const inline int TC_FIFTY_MB = 50;
|
||||
|
||||
static const inline int FIVE_HUNDRED_MS = 500;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_ZERO = 0;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_ONE = 1;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_TWO = 2;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_THREE = 3;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_FOUR = 4;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_FIVE = 5;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_SIX = 6;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_SEVEN = 7;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_EIGHT = 8;
|
||||
static const inline int PER_FIVE_HUNDRED_MS_NINE = 9;
|
||||
|
||||
static const inline int64_t SEC_TO_MILLISEC = 1000;
|
||||
static const inline int64_t MICROSEC_TO_MILLISEC = 1000;
|
||||
};
|
||||
} // namespace MiscServices
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
class DfxCodeConstant {
|
||||
public:
|
||||
static inline const int INITIALIZATION_FAULT = 950001100;
|
||||
static inline const int TIME_CONSUMING_STATISTIC = 950001105;
|
||||
static inline const int PASTEBOARD_BEHAVIOUR = 950001106;
|
||||
static inline constexpr int INITIALIZATION_FAULT = 950001100;
|
||||
static inline constexpr int TIME_CONSUMING_STATISTIC = 950001105;
|
||||
static inline constexpr int PASTEBOARD_BEHAVIOUR = 950001106;
|
||||
};
|
||||
#endif // MISCSERVICES_PASTEBOARD_DFX_CODE_CONSTANT_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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,41 @@ namespace OHOS {
|
||||
using namespace HiviewDFX;
|
||||
namespace MiscServices {
|
||||
namespace {
|
||||
// fault key
|
||||
constexpr const char *USER_ID = "USER_ID";
|
||||
constexpr const char *ERROR_TYPE = "ERROR_TYPE";
|
||||
// statistic key
|
||||
constexpr const char *PASTEBOARD_STATE = "PASTEBOARD_STATE";
|
||||
|
||||
constexpr const char *ZERO_TO_HUNDRED_KB = "ZERO_TO_HUNDRED_KB";
|
||||
constexpr const char *HUNDRED_TO_FIVE_HUNDREDS_KB = "HUNDRED_TO_FIVE_HUNDREDS_KB";
|
||||
constexpr const char *FIVE_HUNDREDS_TO_THOUSAND_KB = "FIVE_HUNDREDS_TO_THOUSAND_KB";
|
||||
constexpr const char *ONE_TO_FIVE_MB = "ONE_TO_FIVE_MB";
|
||||
constexpr const char *FIVE_TO_TEN_MB = "FIVE_TO_TEN_MB";
|
||||
constexpr const char *TEN_TO_FIFTY_MB = "TEN_TO_FIFTY_MB";
|
||||
constexpr const char *OVER_FIFTY_MB = "OVER_FIFTY_MB";
|
||||
constexpr const char *CONSUMING_DATA = "CONSUMING_DATA";
|
||||
constexpr const char *DATA_LEVEL = "DATA_LEVEL";
|
||||
// behaviour key
|
||||
constexpr const char *TOP_ONE_APP = "TOP_ONE_APP";
|
||||
constexpr const char *TOP_TOW_APP = "TOP_TOW_APP";
|
||||
constexpr const char *TOP_THREE_APP = "TOP_THREE_APP";
|
||||
constexpr const char *TOP_FOUR_APP = "TOP_FOUR_APP";
|
||||
constexpr const char *TOP_FIVE_APP = "TOP_FIVE_APP";
|
||||
constexpr const char *TOP_SIX_APP = "TOP_SIX_APP";
|
||||
constexpr const char *TOP_SEVEN_APP = "TOP_SEVEN_APP";
|
||||
constexpr const char *TOP_EIGHT_APP = "TOP_EIGHT_APP";
|
||||
constexpr const char *TOP_NINE_APP = "TOP_NINE_APP";
|
||||
constexpr const char *TOP_TEN_APP = "TOP_TEN_APP";
|
||||
|
||||
constexpr const char *WRONG_LEVEL = "WRONG_LEVEL";
|
||||
|
||||
constexpr const char *COPY_STATE = "COPY_STATE";
|
||||
constexpr const char *PASTE_STATE = "PASTE_STATE";
|
||||
|
||||
constexpr const int INIT_COPY_TIME_SONSUMING = 7;
|
||||
constexpr const int INIT_PASTE_TIME_SONSUMING = 8;
|
||||
|
||||
const std::map<int, std::string> EVENT_COVERT_TABLE = {
|
||||
{ DfxCodeConstant::INITIALIZATION_FAULT, "INITIALIZATION_FAULT" },
|
||||
{ DfxCodeConstant::TIME_CONSUMING_STATISTIC, "TIME_CONSUMING_STATISTIC" },
|
||||
@@ -269,54 +304,34 @@ const char *HiViewAdapter::GetDataLevel(int dataLevel)
|
||||
void HiViewAdapter::InvokeTimeConsuming()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(timeConsumingMutex_);
|
||||
if (!copyTimeConsumingStat_.empty()) {
|
||||
int i = 0;
|
||||
for (auto iter = copyTimeConsumingStat_.begin(); iter != copyTimeConsumingStat_.end(); ++iter) {
|
||||
int ret = HiSysEvent::Write(DOMAIN_STR, CoverEventID(DfxCodeConstant::TIME_CONSUMING_STATISTIC),
|
||||
HiSysEvent::EventType::STATISTIC, PASTEBOARD_STATE, COPY_STATE, DATA_LEVEL, GetDataLevel(i),
|
||||
TIME_CONSUMING_LEVEL_ONE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_ONE)],
|
||||
TIME_CONSUMING_LEVEL_TWO, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_TWO)],
|
||||
TIME_CONSUMING_LEVEL_THREE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_THREE)],
|
||||
TIME_CONSUMING_LEVEL_FOUR, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_FOUR)],
|
||||
TIME_CONSUMING_LEVEL_FIVE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_FIVE)],
|
||||
TIME_CONSUMING_LEVEL_SIX, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_SIX)],
|
||||
TIME_CONSUMING_LEVEL_SEVEN, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_SEVEN)],
|
||||
TIME_CONSUMING_LEVEL_EIGHT, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_EIGHT)],
|
||||
TIME_CONSUMING_LEVEL_NINE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_NINE)],
|
||||
TIME_CONSUMING_LEVEL_TEN, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_TEN)],
|
||||
TIME_CONSUMING_LEVEL_ELEVEN, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_ELEVEN)]);
|
||||
if (ret != 0) {
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "hisysevent write failed! ret %{public}d.", ret);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
} else { PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "hisysevent copyTimeConsumingStat_ is empty."); }
|
||||
if (!pasteTimeConsumingStat_.empty()) {
|
||||
int i = 0;
|
||||
for (auto iter = pasteTimeConsumingStat_.begin(); iter != pasteTimeConsumingStat_.end(); ++iter) {
|
||||
int ret = HiSysEvent::Write(DOMAIN_STR, CoverEventID(DfxCodeConstant::TIME_CONSUMING_STATISTIC),
|
||||
HiSysEvent::EventType::STATISTIC, PASTEBOARD_STATE, PASTE_STATE, DATA_LEVEL, GetDataLevel(i),
|
||||
TIME_CONSUMING_LEVEL_ONE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_ONE)],
|
||||
TIME_CONSUMING_LEVEL_TWO, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_TWO)],
|
||||
TIME_CONSUMING_LEVEL_THREE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_THREE)],
|
||||
TIME_CONSUMING_LEVEL_FOUR, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_FOUR)],
|
||||
TIME_CONSUMING_LEVEL_FIVE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_FIVE)],
|
||||
TIME_CONSUMING_LEVEL_SIX, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_SIX)],
|
||||
TIME_CONSUMING_LEVEL_SEVEN, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_SEVEN)],
|
||||
TIME_CONSUMING_LEVEL_EIGHT, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_EIGHT)],
|
||||
TIME_CONSUMING_LEVEL_NINE, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_NINE)],
|
||||
TIME_CONSUMING_LEVEL_TEN, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_TEN)],
|
||||
TIME_CONSUMING_LEVEL_ELEVEN, (*iter)[static_cast<int>(TimeConsumingLevel::TIME_LEVEL_ELEVEN)]);
|
||||
if (ret != 0) {
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "hisysevent write failed! ret %{public}d.", ret);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
} else { PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "hisysevent pasteTimeConsumingStat_ is empty."); }
|
||||
ReportStatisticEvent(copyTimeConsumingStat_, COPY_STATE);
|
||||
copyTimeConsumingStat_.clear();
|
||||
ReportStatisticEvent(pasteTimeConsumingStat_, PASTE_STATE);
|
||||
pasteTimeConsumingStat_.clear();
|
||||
}
|
||||
|
||||
void HiViewAdapter::ReportStatisticEvent(std::vector<std::map<int, int>> &timeConsumingStat, std::string pasteboardState)
|
||||
{
|
||||
if(timeConsumingStat.empty()) {
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "hisysevent timeConsumingStat is empty.");
|
||||
return;
|
||||
}
|
||||
int i = 0;
|
||||
for (auto iter = timeConsumingStat.begin(); iter != timeConsumingStat.end(); ++iter) {
|
||||
std::string buffMsg = ": [";
|
||||
for (int j = static_cast<int>(TimeConsumingLevel::TIME_LEVEL_ONE); j <= static_cast<int>(TimeConsumingLevel::TIME_LEVEL_ELEVEN); ++j) {
|
||||
buffMsg = buffMsg + std::to_string((*iter)[j]) + ",";
|
||||
}
|
||||
buffMsg += "]";
|
||||
int ret = HiSysEvent::Write(DOMAIN_STR, CoverEventID(DfxCodeConstant::TIME_CONSUMING_STATISTIC),
|
||||
HiSysEvent::EventType::STATISTIC, PASTEBOARD_STATE, pasteboardState, DATA_LEVEL, GetDataLevel(i), CONSUMING_DATA, buffMsg);
|
||||
if (ret != 0) {
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "hisysevent write failed! ret %{public}d.", ret);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void HiViewAdapter::ReportBehaviour(std::map<std::string, int> &behaviour, const char *pasteboardState)
|
||||
{
|
||||
PASTEBOARD_HILOGD(PASTEBOARD_MODULE_SERVICE, "ReportBehaviour enter");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
@@ -38,17 +38,17 @@ enum class DataConsumingLevel {
|
||||
DATA_LEVEL_SEVEN = 6,
|
||||
};
|
||||
enum class TimeConsumingLevel {
|
||||
TIME_LEVEL_ONE = 72,
|
||||
TIME_LEVEL_TWO = 73,
|
||||
TIME_LEVEL_THREE = 74,
|
||||
TIME_LEVEL_FOUR = 75,
|
||||
TIME_LEVEL_FIVE = 76,
|
||||
TIME_LEVEL_SIX = 77,
|
||||
TIME_LEVEL_SEVEN = 78,
|
||||
TIME_LEVEL_EIGHT = 79,
|
||||
TIME_LEVEL_NINE = 80,
|
||||
TIME_LEVEL_TEN = 81,
|
||||
TIME_LEVEL_ELEVEN = 82,
|
||||
TIME_LEVEL_ONE = 9,
|
||||
TIME_LEVEL_TWO = 10,
|
||||
TIME_LEVEL_THREE = 11,
|
||||
TIME_LEVEL_FOUR = 12,
|
||||
TIME_LEVEL_FIVE = 13,
|
||||
TIME_LEVEL_SIX = 14,
|
||||
TIME_LEVEL_SEVEN = 15,
|
||||
TIME_LEVEL_EIGHT = 16,
|
||||
TIME_LEVEL_NINE = 17,
|
||||
TIME_LEVEL_TEN = 18,
|
||||
TIME_LEVEL_ELEVEN = 19,
|
||||
};
|
||||
|
||||
class HiViewAdapter {
|
||||
@@ -71,6 +71,7 @@ private:
|
||||
static const char *GetDataLevel(int dataLevel);
|
||||
static void InvokeTimeConsuming();
|
||||
static void ReportBehaviour(std::map<std::string, int> &behaviour, const char *statePasteboard);
|
||||
static void ReportStatisticEvent(std::vector<std::map<int, int>> &timeConsumingStat, std::string pasteboardState);
|
||||
|
||||
static std::mutex timeConsumingMutex_;
|
||||
static std::vector<std::map<int, int>> copyTimeConsumingStat_;
|
||||
@@ -88,56 +89,11 @@ private:
|
||||
static std::mutex runMutex_;
|
||||
static bool running_;
|
||||
|
||||
static const inline int ONE_DAY_IN_HOURS = 24;
|
||||
static const inline int EXEC_HOUR_TIME = 23;
|
||||
static const inline int EXEC_MIN_TIME = 60;
|
||||
static const inline int ONE_MINUTE_IN_SECONDS = 60;
|
||||
static const inline int ONE_HOUR_IN_SECONDS = 1 * 60 * 60; // 1 hour
|
||||
// fault key
|
||||
static const inline char *USER_ID = "USER_ID";
|
||||
static const inline char *ERROR_TYPE = "ERROR_TYPE";
|
||||
// statistic key
|
||||
static const inline char *PASTEBOARD_STATE = "PASTEBOARD_STATE";
|
||||
static const inline char *DATA_LEVEL = "DATA_LEVEL";
|
||||
|
||||
static const inline char *ZERO_TO_HUNDRED_KB = "ZERO_TO_HUNDRED_KB";
|
||||
static const inline char *HUNDRED_TO_FIVE_HUNDREDS_KB = "HUNDRED_TO_FIVE_HUNDREDS_KB";
|
||||
static const inline char *FIVE_HUNDREDS_TO_THOUSAND_KB = "FIVE_HUNDREDS_TO_THOUSAND_KB";
|
||||
static const inline char *ONE_TO_FIVE_MB = "ONE_TO_FIVE_MB";
|
||||
static const inline char *FIVE_TO_TEN_MB = "FIVE_TO_TEN_MB";
|
||||
static const inline char *TEN_TO_FIFTY_MB = "TEN_TO_FIFTY_MB";
|
||||
static const inline char *OVER_FIFTY_MB = "OVER_FIFTY_MB";
|
||||
|
||||
static const inline char *TIME_CONSUMING_LEVEL_ONE = "TIME_CONSUMING_LEVEL_ONE";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_TWO = "TIME_CONSUMING_LEVEL_TWO";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_THREE = "TIME_CONSUMING_LEVEL_THREE";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_FOUR = "TIME_CONSUMING_LEVEL_FOUR";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_FIVE = "TIME_CONSUMING_LEVEL_FIVE";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_SIX = "TIME_CONSUMING_LEVEL_SIX";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_SEVEN = "TIME_CONSUMING_LEVEL_SEVEN";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_EIGHT = "TIME_CONSUMING_LEVEL_EIGHT";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_NINE = "TIME_CONSUMING_LEVEL_NINE";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_TEN = "TIME_CONSUMING_LEVEL_TEN";
|
||||
static const inline char *TIME_CONSUMING_LEVEL_ELEVEN = "TIME_CONSUMING_LEVEL_ELEVEN";
|
||||
// behaviour key
|
||||
static const inline char *TOP_ONE_APP = "TOP_ONE_APP";
|
||||
static const inline char *TOP_TOW_APP = "TOP_TOW_APP";
|
||||
static const inline char *TOP_THREE_APP = "TOP_THREE_APP";
|
||||
static const inline char *TOP_FOUR_APP = "TOP_FOUR_APP";
|
||||
static const inline char *TOP_FIVE_APP = "TOP_FIVE_APP";
|
||||
static const inline char *TOP_SIX_APP = "TOP_SIX_APP";
|
||||
static const inline char *TOP_SEVEN_APP = "TOP_SEVEN_APP";
|
||||
static const inline char *TOP_EIGHT_APP = "TOP_EIGHT_APP";
|
||||
static const inline char *TOP_NINE_APP = "TOP_NINE_APP";
|
||||
static const inline char *TOP_TEN_APP = "TOP_TEN_APP";
|
||||
|
||||
static const inline char *WRONG_LEVEL = "WRONG_LEVEL";
|
||||
|
||||
static const inline char *COPY_STATE = "COPY_STATE";
|
||||
static const inline char *PASTE_STATE = "PASTE_STATE";
|
||||
|
||||
static const inline int INIT_COPY_TIME_SONSUMING = 80;
|
||||
static const inline int INIT_PASTE_TIME_SONSUMING = 81;
|
||||
static inline constexpr int ONE_DAY_IN_HOURS = 24;
|
||||
static inline constexpr int EXEC_HOUR_TIME = 23;
|
||||
static inline constexpr int EXEC_MIN_TIME = 60;
|
||||
static inline constexpr int ONE_MINUTE_IN_SECONDS = 60;
|
||||
static inline constexpr int ONE_HOUR_IN_SECONDS = 1 * 60 * 60; // 1 hour
|
||||
};
|
||||
} // namespace MiscServices
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2022 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
|
||||
@@ -40,7 +40,7 @@ PasteboardTrace::~PasteboardTrace()
|
||||
FinishTrace(BYTRACE_LABEL);
|
||||
}
|
||||
|
||||
bool PasteboardTrace::SetBytraceEnable()
|
||||
bool PasteboardTrace::SetBytraceEnable() const
|
||||
{
|
||||
if (isSetBytraceEnabled_.exchange(true)) {
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2022 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
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
~PasteboardTrace();
|
||||
|
||||
private:
|
||||
bool SetBytraceEnable();
|
||||
bool SetBytraceEnable() const;
|
||||
static std::atomic_bool isSetBytraceEnabled_;
|
||||
};
|
||||
} // namespace MiscServices
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2022 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2022 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
|
||||
|
||||
Reference in New Issue
Block a user