FrameStats.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifndef ANDROID_UI_FRAME_STATS_H
  17. #define ANDROID_UI_FRAME_STATS_H
  18. #include <utils/Flattenable.h>
  19. #include <utils/Timers.h>
  20. #include <utils/Vector.h>
  21. namespace android {
  22. class FrameStats : public LightFlattenable<FrameStats> {
  23. public:
  24. FrameStats() : refreshPeriodNano(0) {};
  25. /*
  26. * Approximate refresh time, in nanoseconds.
  27. */
  28. nsecs_t refreshPeriodNano;
  29. /*
  30. * The times in nanoseconds for when the frame contents were posted by the producer (e.g.
  31. * the application). They are either explicitly set or defaulted to the time when
  32. * Surface::queueBuffer() was called.
  33. */
  34. Vector<nsecs_t> desiredPresentTimesNano;
  35. /*
  36. * The times in milliseconds for when the frame contents were presented on the screen.
  37. */
  38. Vector<nsecs_t> actualPresentTimesNano;
  39. /*
  40. * The times in nanoseconds for when the frame contents were ready to be presented. Note that
  41. * a frame can be posted and still it contents being rendered asynchronously in GL. In such a
  42. * case these are the times when the frame contents were completely rendered (i.e. their fences
  43. * signaled).
  44. */
  45. Vector<nsecs_t> frameReadyTimesNano;
  46. // LightFlattenable
  47. bool isFixedSize() const;
  48. size_t getFlattenedSize() const;
  49. status_t flatten(void* buffer, size_t size) const;
  50. status_t unflatten(void const* buffer, size_t size);
  51. };
  52. }; // namespace android
  53. #endif // ANDROID_UI_FRAME_STATS_H