Skip to content

Conversation

@teodorciuraru
Copy link
Contributor

Summary

Implements fixed timestamp observer pattern with variable speed event generation to reproduce customer's SDKS-2280 CPU usage issue.

Observer Changes

  • ✅ Switch from sliding window (900s) to fixed timestamp approach
  • ✅ Timestamp set ONCE when observer starts (matches customer's pattern)
  • ✅ All events from timestamp forward accumulate (no re-registration)
  • ✅ Removed unused variables and methods (sliding window cleanup)
  • ✅ Cleaned up task-related code (focus on reproduction only)

UI Improvements

  • Variable speed slider (0.5 - 10 events/sec) for testing callback flooding
  • Connection info card showing peer connections and transport types
  • ✅ Dynamic speed adjustment while generation is running
  • ✅ Simplified UI to Producer Mode and Consumer Mode sections

Event Generator

  • ✅ Configurable generation speed (0.5 - 10 events/sec)
  • ✅ Real-time speed adjustment via slider
  • ✅ Allows testing callback flooding at different event rates

Purpose

Reproduce customer's exact SDKS-2280 CPU issue:

  • Fixed timestamp from match start (accumulates ALL events)
  • No backpressure mechanism (callbacks flood consumer)
  • Variable speed to test callback saturation
  • Expected: CPU spikes (30-40%+) with high event rates

Testing

  1. Consumer device: Toggle "Observer Active" → sets fixed timestamp
  2. Producer device: Select "Large (3.3KB)" + adjust speed slider
  3. Watch CPU usage increase as events accumulate
  4. Test different speeds to observe callback flooding effect

Files Changed

  • lib/main.dart - Fixed timestamp observer, UI improvements, connection info
  • lib/services/event_generator.dart - Variable speed generation

🤖 Generated with Claude Code

- Switch from sliding window (900s) to fixed timestamp approach
- Timestamp set ONCE when observer starts (matches customer's pattern)
- All events from timestamp forward accumulate (no re-registration)
- Remove unused variables: _thresholdSecondsAgo, _bulkEventCount, etc.
- Remove unused methods: _clearEvents, _generateBulkEvents, _manualResubscribe
- Clean up task-related code (removed _fab, _tasksList, _singleTask)
- Remove unused imports (dialog.dart, dql_builder.dart, task.dart)

- Add connection info card showing peer connections and transport types
- Display connected peers, connection types (Bluetooth, WiFi, WebSocket), and distance
- Update app title to "Ditto CPU Reproduction"
- Simplify UI to Producer Mode and Consumer Mode sections

- Add configurable generation speed (0.5 - 10 events/sec)
- Add slider control for dynamic speed adjustment while running
- Speed changes update timer interval in real-time
- Allows testing callback flooding at different event rates

Reproduce customer's SDKS-2280 CPU issue with exact observer pattern:
- Fixed timestamp from match start (accumulates ALL events)
- No backpressure mechanism (callbacks flood consumer)
- Variable speed generation to test callback saturation
- CPU spikes (30-40%+) expected with high event rates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@teodorciuraru teodorciuraru deleted the sdks-2280-flutter-fixed-timestamp branch December 4, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants