diff --git a/hisysevent.yaml b/hisysevent.yaml index f4cdb0e8de..64579f6390 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -70,7 +70,7 @@ EPS_LCD_FREQ: JANK_STATS_RS: __BASE: {type: STATISTIC, level: MINOR, tag: performance, desc: jank statistic} - STARTTIME: {type: UINT32, desc: begin time since last report} - DURATION: {type: UINT32, desc: duration since last report} - JANK_STATS: {type: STRING, desc: jank frame stats} + STARTTIME: {type: UINT64, desc: begin time since last report} + DURATION: {type: UINT64, desc: duration since last report} + JANK_STATS: {type: UINT16, desc: jank frame stats} JANK_STATS_VER: {type: UINT32, desc: jank range version} diff --git a/rosen/modules/render_service/core/pipeline/rs_jank_stats.cpp b/rosen/modules/render_service/core/pipeline/rs_jank_stats.cpp index eb4f1a3dc2..0439b3c7c6 100644 --- a/rosen/modules/render_service/core/pipeline/rs_jank_stats.cpp +++ b/rosen/modules/render_service/core/pipeline/rs_jank_stats.cpp @@ -36,7 +36,7 @@ RSJankStats& RSJankStats::GetInstance() void RSJankStats::SetStartTime() { - auto start = std::chrono::steady_clock::now().time_since_epoch(); + auto start = std::chrono::system_clock::now().time_since_epoch(); startTime_ = std::chrono::duration_cast(start).count(); if (isfirstSetStart_) { lastReportTime_ = startTime_; @@ -46,7 +46,7 @@ void RSJankStats::SetStartTime() void RSJankStats::SetEndTime() { - auto end = std::chrono::steady_clock::now().time_since_epoch(); + auto end = std::chrono::system_clock::now().time_since_epoch(); endTime_ = std::chrono::duration_cast(end).count(); auto duration = endTime_ - startTime_; if (duration >= VSYNC_PERIOD) { @@ -77,27 +77,27 @@ void RSJankStats::SetRSJankStats(int times) ROSEN_LOGW("RSInterfaces::SetJankStatas Jank Frame Skip more than 180"); return; } - if (rsJankStats_[type] != ULONG_MAX) { + if (rsJankStats_[type] != USHRT_MAX) { rsJankStats_[type]++; } + isNeedReport_ = true; } void RSJankStats::ReportJankStats() { - auto report = std::chrono::steady_clock::now().time_since_epoch(); + if (!isNeedReport_) { + ROSEN_LOGW("RSInterfaces::ReportJankStats Nothing need to report"); + return; + } + auto report = std::chrono::system_clock::now().time_since_epoch(); auto reportTime = std::chrono::duration_cast(report).count(); auto reportDuration = reportTime - lastReportTime_; - std::string msg = ""; - for (int index = 0; index < JANK_STATS_SIZE; index++) { - msg += std::to_string(rsJankStats_[index]); - rsJankStats_[index] = 0; - msg += ","; - } auto reportName = "JANK_STATS_RS"; HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::GRAPHIC, reportName, OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, "STARTTIME", lastReportTime_, "DURATION", reportDuration, - "JANK_STATS", msg, "JANK_STATS_VER", 1); + "JANK_STATS", rsJankStats_, "JANK_STATS_VER", 1); lastReportTime_ = reportTime; + isNeedReport_ = false; } } // namespace Rosen diff --git a/rosen/modules/render_service/core/pipeline/rs_jank_stats.h b/rosen/modules/render_service/core/pipeline/rs_jank_stats.h index a65f39dd42..a7d8e0ec02 100644 --- a/rosen/modules/render_service/core/pipeline/rs_jank_stats.h +++ b/rosen/modules/render_service/core/pipeline/rs_jank_stats.h @@ -17,6 +17,7 @@ #define ROSEN_JANK_STATS_H #include +#include namespace OHOS { namespace Rosen { @@ -37,10 +38,11 @@ private: void operator=(const RSJankStats&&) = delete; constexpr static int JANK_STATS_SIZE = 8; bool isfirstSetStart_ = true; - uint32_t startTime_ = 0; - uint32_t endTime_ = 0; - uint32_t lastReportTime_ = 0; - uint64_t rsJankStats_[JANK_STATS_SIZE] = { 0 }; + bool isNeedReport_ = false; + uint64_t startTime_ = 0; + uint64_t endTime_ = 0; + uint64_t lastReportTime_ = 0; + std::vector rsJankStats_ = std::vector(JANK_STATS_SIZE, 0); enum JankRangeType : int16_t { JANK_FRAME_6_FREQ = 0,