hitchTime bugfix

Signed-off-by: frank-huangran <frank.huangran@huawei.com>
This commit is contained in:
frank-huangran 2024-09-19 11:09:57 +08:00
parent e1600c119c
commit ed81fd5162
2 changed files with 23 additions and 24 deletions

View File

@ -37,8 +37,7 @@ public:
double GetTimes(std::string line, const std::string &sign) const;
void AppList(std::string line, const std::string &signS, const std::string &signF);
void APPTabs(std::string line, const std::string &signS, const std::string &signF);
void AppSwiperScroll(std::string line, const std::string &signS);
void AppSwiperFrameRate(std::string line);
void AppSwiperScroll(std::string line, const std::string &signS, const std::string &signF);
void GetRsHardWareRate(double curFrameRate, std::string line, SWIM_TYPE type);
void GetFrameLossTime(double curTime, double prevTime, double drawTime, double &totalFrameLossTime);
void CalcFrameRate();

View File

@ -53,24 +53,7 @@ double StallingRateTrace::CalculateTime()
std::string line;
while (getline(infile, line)) {
AppList(line, signS, signF);
AppSwiperScroll(line, signS);
if (line.find("H:APP_SWIPER_FLING,") != std::string::npos ||
line.find("H:APP_SWIPER_NO_ANIMATION_SWITCH") != std::string::npos ||
line.find("H:APP_SWITCH_FRAME_ANIMATION") != std::string::npos) {
if (swiperFlingFlag == 1) {
LOGI("AppSwiper FinishTime line: (%s)", line.c_str());
swiperDynamicFinishTime = GetTimes(line, signF);
LOGI("swiperDynamicFinishTime: (%s)", std::to_string(swiperDynamicFinishTime).c_str());
swiperFlag = false;
}
if (swiperDynamicFinishTime == 0) {
swiperFlingFlag = 0;
} else if (swiperDynamicFinishTime != 0) {
break;
}
swiperFlingFlag++;
}
AppSwiperFrameRate(line);
AppSwiperScroll(line, signS, signF);
APPTabs(line, signS, signF);
}
CalcFrameRate();
@ -198,10 +181,12 @@ void StallingRateTrace::AppList(std::string line, const std::string &signS, cons
line.find("H:LAUNCHER_APP_LAUNCH_FROM_DOCK,") != std::string::npos ||
line.find("H:LAUNCHER_APP_LAUNCH_FROM_APPCENTER,") != std::string::npos) {
if (listFlag) {
LOGI("AppList finishTime line: (%s)", line.c_str());
appListDynamicFinishTime = GetTimes(line, signF);
LOGI("appListDynamicFinishTime: (%s)", std::to_string(appListDynamicFinishTime).c_str());
listFlag = false;
} else {
LOGI("AppList startTime line: (%s)", line.c_str());
appListDynamicStartTime = GetTimes(line, signS);
LOGI("appListDynamicStartTime: (%s)", std::to_string(appListDynamicStartTime).c_str());
listFlag = true;
@ -301,21 +286,34 @@ void StallingRateTrace::UpdateRoundTime(double curFrameRate, SWIM_TYPE type)
}
}
void StallingRateTrace::AppSwiperScroll(std::string line, const std::string &signS)
void StallingRateTrace::AppSwiperScroll(std::string line, const std::string &signS, const std::string &signF)
{
if (line.find("H:APP_SWIPER_NO_ANIMATION_SWITCH") != std::string::npos ||
line.find("H:APP_SWITCH_FRAME_ANIMATION") != std::string::npos ||
line.find("H:APP_SWIPER_SCROLL,") != std::string::npos) {
if (swiperScrollFlag == 0) {
LOGI("AppSwiperScroll startTime line: (%s)", line.c_str());
swiperDynamicStartTime = GetTimes(line, signS);
LOGI("swiperDynamicStartTime: (%s)", std::to_string(swiperDynamicStartTime).c_str());
frameLossSwiperTime = 0;
swiperScrollFlag = 1;
swiperFlag = true;
}
}
}
void StallingRateTrace::AppSwiperFrameRate(std::string line)
{
if (line.find("H:APP_SWIPER_FLING,") != std::string::npos ||
line.find("H:APP_SWIPER_NO_ANIMATION_SWITCH") != std::string::npos ||
line.find("H:APP_SWITCH_FRAME_ANIMATION") != std::string::npos) {
if (swiperFlingFlag == 1) {
LOGI("AppSwiperScroll finishTime line: (%s)", line.c_str());
swiperDynamicFinishTime = GetTimes(line, signF);
LOGI("swiperDynamicFinishTime: (%s)", std::to_string(swiperDynamicFinishTime).c_str());
swiperFlag = false;
}
if (swiperDynamicFinishTime == 0) {
swiperFlingFlag = 0;
}
swiperFlingFlag++;
}
if (swiperFlag) {
GetRsHardWareRate(nowSwiperFrameRate, line, SWIM_APPSWIPER);
if (upperScreenSwiperFlag) {
@ -342,10 +340,12 @@ void StallingRateTrace::APPTabs(std::string line, const std::string &signS, cons
line.find("H:APP_TABS_FRAME_ANIMATION") != std::string::npos ||
line.find("H:APP_TABS_SCROLL,") != std::string::npos) {
if (tabsFlag) {
LOGI("APPTabs finishTime line: (%s)", line.c_str());
appTabsDynamicFinishTime = GetTimes(line, signF);
LOGI("appTabsDynamicFinishTime: (%s)", std::to_string(appTabsDynamicFinishTime).c_str());
tabsFlag = false;
} else {
LOGI("APPTabs startTime line: (%s)", line.c_str());
appTabsDynamicStartTime = GetTimes(line, signS);
LOGI("appTabsDynamicStartTime: (%s)", std::to_string(appTabsDynamicStartTime).c_str());
tabsFlag = true;