summaryrefslogtreecommitdiff
path: root/libs/hwui/JankTracker.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-03-11 08:50:53 -0700
committerJohn Reck <jreck@google.com>2015-03-11 11:29:13 -0700
commitb36016c65f1d1b5846dba0349aab491dbd3a746a (patch)
tree6ce0e78368d6797988cc9b9745b20de5919bb19f /libs/hwui/JankTracker.cpp
parent4771577a342214ef4f7373a8d37d015749b00347 (diff)
Cleanups & simplifications
Change-Id: I5ad5e3b8fe55b1528f2e20c63e5abe51d9e40ff1
Diffstat (limited to 'libs/hwui/JankTracker.cpp')
-rw-r--r--libs/hwui/JankTracker.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp
index 46b094556ad7..7df61f272c44 100644
--- a/libs/hwui/JankTracker.cpp
+++ b/libs/hwui/JankTracker.cpp
@@ -97,8 +97,8 @@ void JankTracker::addFrame(const FrameInfo& frame) {
int64_t totalDuration =
frame[FrameInfoIndex::kFrameCompleted] - frame[FrameInfoIndex::kIntendedVsync];
uint32_t framebucket = std::min(
- static_cast<typeof sizeof(mFrameCounts)>(ns2ms(totalDuration)),
- sizeof(mFrameCounts) / sizeof(mFrameCounts[0]));
+ static_cast<typeof mFrameCounts.size()>(ns2ms(totalDuration)),
+ mFrameCounts.size());
// Keep the fast path as fast as possible.
if (CC_LIKELY(totalDuration < mFrameInterval)) {
mFrameCounts[framebucket]++;
@@ -137,8 +137,8 @@ void JankTracker::dump(int fd) {
}
void JankTracker::reset() {
- memset(mBuckets, 0, sizeof(mBuckets));
- memset(mFrameCounts, 0, sizeof(mFrameCounts));
+ mBuckets.fill({0});
+ mFrameCounts.fill(0);
mTotalFrameCount = 0;
mJankFrameCount = 0;
}
@@ -146,7 +146,7 @@ void JankTracker::reset() {
uint32_t JankTracker::findPercentile(int percentile) {
int pos = percentile * mTotalFrameCount / 100;
int remaining = mTotalFrameCount - pos;
- for (int i = sizeof(mFrameCounts) / sizeof(mFrameCounts[0]) - 1; i >= 0; i--) {
+ for (int i = mFrameCounts.size() - 1; i >= 0; i--) {
remaining -= mFrameCounts[i];
if (remaining <= 0) {
return i;