Loading services/surfaceflinger/SurfaceFlinger.cpp +3 −2 Original line number Original line Diff line number Diff line Loading @@ -2017,8 +2017,9 @@ bool SurfaceFlinger::handleMessageTransaction() { bool flushedATransaction = flushTransactionQueues(); bool flushedATransaction = flushTransactionQueues(); bool runHandleTransaction = transactionFlags && bool runHandleTransaction = ((transactionFlags != eTransactionFlushNeeded) || flushedATransaction); (transactionFlags && (transactionFlags != eTransactionFlushNeeded)) || flushedATransaction; if (runHandleTransaction) { if (runHandleTransaction) { handleTransaction(eTransactionMask); handleTransaction(eTransactionMask); Loading services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,9 @@ std::string TimeStatsHelper::TimeStatsLayer::toString() const { StringAppendF(&result, "badDesiredPresentFrames = %d\n", badDesiredPresentFrames); StringAppendF(&result, "badDesiredPresentFrames = %d\n", badDesiredPresentFrames); const auto iter = deltas.find("present2present"); const auto iter = deltas.find("present2present"); if (iter != deltas.end()) { if (iter != deltas.end()) { StringAppendF(&result, "averageFPS = %.3f\n", 1000.0 / iter->second.averageTime()); const float averageTime = iter->second.averageTime(); const float averageFPS = averageTime < 1.0f ? 0.0f : 1000.0f / averageTime; StringAppendF(&result, "averageFPS = %.3f\n", averageFPS); } } for (const auto& ele : deltas) { for (const auto& ele : deltas) { StringAppendF(&result, "%s histogram is as below:\n", ele.first.c_str()); StringAppendF(&result, "%s histogram is as below:\n", ele.first.c_str()); Loading services/surfaceflinger/tests/unittests/TimeStatsTest.cpp +9 −0 Original line number Original line Diff line number Diff line Loading @@ -833,6 +833,15 @@ TEST_F(TimeStatsTest, canDumpWithInvalidMaxLayers) { ASSERT_EQ(0, globalProto.stats_size()); ASSERT_EQ(0, globalProto.stats_size()); } } TEST_F(TimeStatsTest, noInfInAverageFPS) { EXPECT_TRUE(inputCommand(InputCommand::ENABLE, FMT_STRING).empty()); insertTimeRecord(NORMAL_SEQUENCE, LAYER_ID_0, 1, 1000000); insertTimeRecord(NORMAL_SEQUENCE, LAYER_ID_0, 2, 1000000); const std::string result(inputCommand(InputCommand::DUMP_ALL, FMT_STRING)); EXPECT_THAT(result, HasSubstr("averageFPS = 0.000")); } namespace { namespace { std::string buildExpectedHistogramBytestring(const std::vector<int32_t>& times, std::string buildExpectedHistogramBytestring(const std::vector<int32_t>& times, const std::vector<int32_t>& frameCounts) { const std::vector<int32_t>& frameCounts) { Loading Loading
services/surfaceflinger/SurfaceFlinger.cpp +3 −2 Original line number Original line Diff line number Diff line Loading @@ -2017,8 +2017,9 @@ bool SurfaceFlinger::handleMessageTransaction() { bool flushedATransaction = flushTransactionQueues(); bool flushedATransaction = flushTransactionQueues(); bool runHandleTransaction = transactionFlags && bool runHandleTransaction = ((transactionFlags != eTransactionFlushNeeded) || flushedATransaction); (transactionFlags && (transactionFlags != eTransactionFlushNeeded)) || flushedATransaction; if (runHandleTransaction) { if (runHandleTransaction) { handleTransaction(eTransactionMask); handleTransaction(eTransactionMask); Loading
services/surfaceflinger/TimeStats/timestatsproto/TimeStatsHelper.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,9 @@ std::string TimeStatsHelper::TimeStatsLayer::toString() const { StringAppendF(&result, "badDesiredPresentFrames = %d\n", badDesiredPresentFrames); StringAppendF(&result, "badDesiredPresentFrames = %d\n", badDesiredPresentFrames); const auto iter = deltas.find("present2present"); const auto iter = deltas.find("present2present"); if (iter != deltas.end()) { if (iter != deltas.end()) { StringAppendF(&result, "averageFPS = %.3f\n", 1000.0 / iter->second.averageTime()); const float averageTime = iter->second.averageTime(); const float averageFPS = averageTime < 1.0f ? 0.0f : 1000.0f / averageTime; StringAppendF(&result, "averageFPS = %.3f\n", averageFPS); } } for (const auto& ele : deltas) { for (const auto& ele : deltas) { StringAppendF(&result, "%s histogram is as below:\n", ele.first.c_str()); StringAppendF(&result, "%s histogram is as below:\n", ele.first.c_str()); Loading
services/surfaceflinger/tests/unittests/TimeStatsTest.cpp +9 −0 Original line number Original line Diff line number Diff line Loading @@ -833,6 +833,15 @@ TEST_F(TimeStatsTest, canDumpWithInvalidMaxLayers) { ASSERT_EQ(0, globalProto.stats_size()); ASSERT_EQ(0, globalProto.stats_size()); } } TEST_F(TimeStatsTest, noInfInAverageFPS) { EXPECT_TRUE(inputCommand(InputCommand::ENABLE, FMT_STRING).empty()); insertTimeRecord(NORMAL_SEQUENCE, LAYER_ID_0, 1, 1000000); insertTimeRecord(NORMAL_SEQUENCE, LAYER_ID_0, 2, 1000000); const std::string result(inputCommand(InputCommand::DUMP_ALL, FMT_STRING)); EXPECT_THAT(result, HasSubstr("averageFPS = 0.000")); } namespace { namespace { std::string buildExpectedHistogramBytestring(const std::vector<int32_t>& times, std::string buildExpectedHistogramBytestring(const std::vector<int32_t>& times, const std::vector<int32_t>& frameCounts) { const std::vector<int32_t>& frameCounts) { Loading