1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_UI_FRAME_STATS_H 18 #define ANDROID_UI_FRAME_STATS_H 19 20 #include <utils/Flattenable.h> 21 #include <utils/Timers.h> 22 #include <utils/Vector.h> 23 24 namespace android { 25 26 class FrameStats : public LightFlattenable<FrameStats> { 27 public: 28 FrameStats() : refreshPeriodNano(0) {}; 29 30 /* 31 * Approximate refresh time, in nanoseconds. 32 */ 33 nsecs_t refreshPeriodNano; 34 35 /* 36 * The times in nanoseconds for when the frame contents were posted by the producer (e.g. 37 * the application). They are either explicitly set or defaulted to the time when 38 * Surface::queueBuffer() was called. 39 */ 40 Vector<nsecs_t> desiredPresentTimesNano; 41 42 /* 43 * The times in milliseconds for when the frame contents were presented on the screen. 44 */ 45 Vector<nsecs_t> actualPresentTimesNano; 46 47 /* 48 * The times in nanoseconds for when the frame contents were ready to be presented. Note that 49 * a frame can be posted and still it contents being rendered asynchronously in GL. In such a 50 * case these are the times when the frame contents were completely rendered (i.e. their fences 51 * signaled). 52 */ 53 Vector<nsecs_t> frameReadyTimesNano; 54 55 // LightFlattenable 56 bool isFixedSize() const; 57 size_t getFlattenedSize() const; 58 status_t flatten(void* buffer, size_t size) const; 59 status_t unflatten(void const* buffer, size_t size); 60 }; 61 62 }; // namespace android 63 64 #endif // ANDROID_UI_FRAME_STATS_H 65