diff options
| author | Siarhei Vishniakou <svv@google.com> | 2021-02-17 06:19:36 +0000 |
|---|---|---|
| committer | Siarhei Vishniakou <svv@google.com> | 2021-02-18 22:07:09 +0000 |
| commit | 4bcbffd584755b90eb0b8690375f02fd3850ad79 (patch) | |
| tree | 13b73038b57b1169f7c90bf9cac2bf0eeba97870 /core/java | |
| parent | be7698d68af250c156ae6b436528e4a3c610f78f (diff) | |
Add presentTime to FrameInfo
Present time is available to apps, but is not currently stored inside
FrameInfo. In this CL, we add a location for storing the present time inside
FrameInfo.
Currently, the metrics reporter is triggered after the buffer is sent to
SurfaceFlinger. That means, metrics for anything that happens after gpu
draw completes are currently not available.
In a future CL, we will populate the 'presentTime' field.
In a future CL, we will register a metrics observer inside ViewRootImpl
in order to send this data to InputDispatcher. This will enable
end-to-end touch latency metrics collection.
Bug: 169866723
Test: printed present time inside FrameTimeline.cpp (surfaceflinger
side) and compared to the values printed inside a metrics observer
registered in ViewRootImpl (not done in this CL)
Test: atest ViewFrameInfoTest
Change-Id: I7d0f8c5d7b5a2572abdc4e107123e8938a36f582
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/FrameMetrics.java | 38 | ||||
| -rw-r--r-- | core/java/android/view/ViewFrameInfo.java | 4 |
2 files changed, 23 insertions, 19 deletions
diff --git a/core/java/android/view/FrameMetrics.java b/core/java/android/view/FrameMetrics.java index 6543de15f969..eb49e52d5050 100644 --- a/core/java/android/view/FrameMetrics.java +++ b/core/java/android/view/FrameMetrics.java @@ -213,8 +213,7 @@ public final class FrameMetrics { Index.FRAME_TIMELINE_VSYNC_ID, Index.INTENDED_VSYNC, Index.VSYNC, - Index.OLDEST_INPUT_EVENT, - Index.NEWEST_INPUT_EVENT, + Index.INPUT_EVENT_ID, Index.HANDLE_INPUT_START, Index.ANIMATION_START, Index.PERFORM_TRAVERSALS_START, @@ -225,8 +224,11 @@ public final class FrameMetrics { Index.ISSUE_DRAW_COMMANDS_START, Index.SWAP_BUFFERS, Index.FRAME_COMPLETED, + Index.DEQUEUE_BUFFER_DURATION, + Index.QUEUE_BUFFER_DURATION, Index.GPU_COMPLETED, - Index.SWAP_BUFFERS_COMPLETED + Index.SWAP_BUFFERS_COMPLETED, + Index.DISPLAY_PRESENT_TIME, }) @Retention(RetentionPolicy.SOURCE) public @interface Index { @@ -234,20 +236,22 @@ public final class FrameMetrics { int FRAME_TIMELINE_VSYNC_ID = 1; int INTENDED_VSYNC = 2; int VSYNC = 3; - int OLDEST_INPUT_EVENT = 4; - int NEWEST_INPUT_EVENT = 5; - int HANDLE_INPUT_START = 6; - int ANIMATION_START = 7; - int PERFORM_TRAVERSALS_START = 8; - int DRAW_START = 9; - int FRAME_DEADLINE = 10; - int SYNC_QUEUED = 11; - int SYNC_START = 12; - int ISSUE_DRAW_COMMANDS_START = 13; - int SWAP_BUFFERS = 14; - int FRAME_COMPLETED = 15; - int GPU_COMPLETED = 18; - int SWAP_BUFFERS_COMPLETED = 19; + int INPUT_EVENT_ID = 4; + int HANDLE_INPUT_START = 5; + int ANIMATION_START = 6; + int PERFORM_TRAVERSALS_START = 7; + int DRAW_START = 8; + int FRAME_DEADLINE = 9; + int SYNC_QUEUED = 10; + int SYNC_START = 11; + int ISSUE_DRAW_COMMANDS_START = 12; + int SWAP_BUFFERS = 13; + int FRAME_COMPLETED = 14; + int DEQUEUE_BUFFER_DURATION = 15; + int QUEUE_BUFFER_DURATION = 16; + int GPU_COMPLETED = 17; + int SWAP_BUFFERS_COMPLETED = 18; + int DISPLAY_PRESENT_TIME = 19; int FRAME_STATS_COUNT = 20; // must always be last and in sync with // FrameInfoIndex::NumIndexes in libs/hwui/FrameInfo.h diff --git a/core/java/android/view/ViewFrameInfo.java b/core/java/android/view/ViewFrameInfo.java index 890d071f8090..d4aaa611f800 100644 --- a/core/java/android/view/ViewFrameInfo.java +++ b/core/java/android/view/ViewFrameInfo.java @@ -58,8 +58,8 @@ public class ViewFrameInfo { public void populateFrameInfo(FrameInfo frameInfo) { frameInfo.frameInfo[FrameInfo.FLAGS] |= flags; frameInfo.frameInfo[FrameInfo.DRAW_START] = drawStart; - frameInfo.frameInfo[FrameInfo.OLDEST_INPUT_EVENT] = oldestInputEventTime; - frameInfo.frameInfo[FrameInfo.NEWEST_INPUT_EVENT] = newestInputEventTime; + // TODO(b/169866723): Use InputEventAssigner + frameInfo.frameInfo[FrameInfo.INPUT_EVENT_ID] = newestInputEventTime; } /** |
