A Flutter application designed to measure and compare input detection latency and screen render timing across different button implementation methods.
This app helps researchers and developers measure the complete input→display pipeline latency by:
- Comparing Button Implementations: Test different Flutter input detection methods
- High-Precision Timing: Microsecond-accurate measurements using
Stopwatch - Frame-Accurate Rendering: Track exact frame timing using Flutter's
scheduleFrameCallback - External Device Sync: Precise sync pulses for aligning with external measurement tools
- Visual Feedback: Real-time indicators for button presses and sync signals
Because different button implementations can have varying latency characteristics, this app includes multiple button types for comparison:
GestureDetectorTapButton- UsesGestureDetector.onTapGestureDetectorTapDownButton- UsesGestureDetector.onTapDownGestureDetectorPanDownButton- UsesGestureDetector.onPanDownRawGestureDetectorTapButton- UsesRawGestureDetector.onTapListenerPointerDownButton- UsesListener.onPointerDown
- Touch Detection: Timestamp when input is first detected
- Frame Timing: Start/end timestamps for frame rendering
- Display Feedback: When visual changes begin/end
- Sync Pulses: Reference signals for external device alignment
- White Square (Right): Appears when button is pressed
- White Square (Left): Flashes with sync pulses
- Flutter SDK (latest stable)
- iOS/Android device or simulator
- Optional: Force Sensitive Resistor (FSR) and photodiodes for external measurements
- Clone the repository
git clone https://github.com/NexusDynamic/button_display_latency
cd button_display_latency- Install dependencies
flutter pub get- Run the app
flutter run --release- Select Button Type: Use dropdown to choose implementation
- Clear Logs: Start fresh measurement session
- Test: Tap the main button repeatedly
- Export: Get CSV data for analysis (via share dialogue)
For the best results, you should have a Force Sensitive Resistor (FSR) and photodiode connected to your measurement device:
- Position FSR over the main test button
- Position photodiode over the left-side sync square
- Position a second photodiode over the right-side button press indicator
- Connect both to your measurement device (oscilloscope, data logger, etc.) -> Bela / Beaglebone Black code to come soon
- Clear Logs: Reset all timing data
- Sync Pulse: Generate single sync event (and display)
- Start Sync: Begin continuous sync pulse generation (100ms intervals)
- Stop Sync: End sync pulse generation
- Export Logs: Print CSV data to console
EventType,TimestampMicros,ButtonType,FrameNumber
touchDetected,1234567,GestureDetectorTapButton,
displayStart,1234580,,15
frameStart,1234590,,15
frameEnd,1234610,,15
displayEnd,1284567,,
syncPulse,1300000,,
This project is licensed under the MIT License - see the LICENSE file for details.
- Android Timing Variance: Sync pulse timing may vary on some Android devices due to system scheduling
- Refresh Rate Limitations: High refresh rate requests may not be honored on all devices
- Precision Limits: Some older devices may have limited timing precision capabilities
- Background Processing: System background tasks may affect timing measurements