Skip to content

Commit

Permalink
Update DragLatency.md
Browse files Browse the repository at this point in the history
Describe the drag latency calculation with a screenshot.
  • Loading branch information
kamrik committed Mar 1, 2017
1 parent c875339 commit 059be16
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/DragLatency.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,18 @@ Sample measurements
| Nexus 9 | MMB29K (6.0.1) | 10.2 |


## Drag latency calculation

The app collects all the motion events reported by Android with their coordinates and timestamps. The plot on the scrennshot below show the vertical coordinate as a function of time as seen by the app _y_(_t_).

The red 'x' marks are points where the finger was at times _t<sub>i</sub>_ when the finger went into or out of the laser beam. The y distance between the two lines of x marks is roughly the thickness of the finger. For now consider only one of the lines, e.g. the upper one.

Now imagine that the clocks timestamping the touch and the laser events diverge a little (this divergence is the latency we want to measure). The red 'x' marks would move along the graph. But half of them would move up and half down (corresponding to direction of the finger movement in that point) and therefore they would diverge in opposite directions from the relatively straight horizontal line you see on the screenshot.

The WALT app finds a shift _S_ such that the standard deviation of _y_( _t<sub>i</sub>_ + _S_) is minimal - that is the 'x' marks are as close as possible to a horizontal straight line on the graph below. The reported number is the average of the two time shifts calculated separately for the upper and the lower lines (corresponding to two sides of the finger).

This calculation that only looks at the _y_ coordinate assumes the laser beam is parallel to the _x_ axis and prefers no motion of the finger in the _x_ direction.

The Python script used for ChromeOS employs a 2D extension of this method (implemented in [minimization.py](/pywalt/minimization.py)). This has the opposite requirement of some considerable spread of the collected _x_ coordinates.

![Drag/scroll latency measurement results](Drag_screen_N5X.png)

0 comments on commit 059be16

Please sign in to comment.