diff options
author | John Reck <jreck@google.com> | 2015-02-19 14:36:50 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-02-20 08:27:38 -0800 |
commit | ba6adf66d3c44c0aa2fd8a224862ff1901d64300 (patch) | |
tree | 8172a893f00caa283cf0386dd3d585ca8fac867c /libs/hwui/JankTracker.h | |
parent | 004a46eb171bc86a3d40eb8fc6a4d9eed48027c7 (diff) | |
download | frameworks_base-ba6adf66d3c44c0aa2fd8a224862ff1901d64300.zip frameworks_base-ba6adf66d3c44c0aa2fd8a224862ff1901d64300.tar.gz frameworks_base-ba6adf66d3c44c0aa2fd8a224862ff1901d64300.tar.bz2 |
Initial attempt at jank-tracking stat collection
Is a bit naive, perhaps overly aggressive, but sorta works
Change-Id: I01a774e00dbe681439c02557d9728ae43c45ce50
Diffstat (limited to 'libs/hwui/JankTracker.h')
-rw-r--r-- | libs/hwui/JankTracker.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/libs/hwui/JankTracker.h b/libs/hwui/JankTracker.h new file mode 100644 index 0000000..aa554cd --- /dev/null +++ b/libs/hwui/JankTracker.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef JANKTRACKER_H_ +#define JANKTRACKER_H_ + +#include "FrameInfo.h" +#include "renderthread/TimeLord.h" +#include "utils/RingBuffer.h" + +#include <memory> + +namespace android { +namespace uirenderer { + +enum JankType { + kMissedVsync = 0, + kHighInputLatency, + kSlowUI, + kSlowSync, + kSlowRT, + + // must be last + NUM_BUCKETS, +}; + +struct JankBucket { + // Number of frames that hit this bucket + uint32_t count; +}; + +// TODO: Replace DrawProfiler with this +class JankTracker { +public: + JankTracker(nsecs_t frameIntervalNanos); + + void setFrameInterval(nsecs_t frameIntervalNanos); + + void addFrame(const FrameInfo& frame); + + void dump(int fd); + void reset(); + +private: + JankBucket mBuckets[NUM_BUCKETS]; + int64_t mThresholds[NUM_BUCKETS]; + + int64_t mFrameInterval; + uint32_t mTotalFrameCount; + uint32_t mJankFrameCount; +}; + +} /* namespace uirenderer */ +} /* namespace android */ + +#endif /* JANKTRACKER_H_ */ |