feat: Add work_time_ms to benchmark logging for load analysis

Track actual work time separately from frame time to determine
system load percentage:
- work_time_ms: Time spent doing actual work before display()
- sleep_time = frame_time_ms - work_time_ms

This allows calculating load percentage:
  load% = (work_time / frame_time) * 100

Example at 60fps with light load:
- frame_time: 16.67ms, work_time: 2ms
- load: 12%, sleep: 14.67ms

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
John McCardle 2025-11-28 16:13:40 -05:00
commit 8583db7225
5 changed files with 16 additions and 3 deletions

View file

@ -28,6 +28,7 @@ struct BenchmarkFrame {
int fps;
// Detailed timing breakdown
float work_time_ms; // Actual work time (frame_time - sleep_time)
float grid_render_ms;
float entity_render_ms;
float python_time_ms;
@ -172,6 +173,7 @@ public:
file << " \"timestamp_ms\": " << std::fixed << std::setprecision(3) << f.timestamp_ms << ",\n";
file << " \"frame_time_ms\": " << std::setprecision(3) << f.frame_time_ms << ",\n";
file << " \"fps\": " << f.fps << ",\n";
file << " \"work_time_ms\": " << std::setprecision(3) << f.work_time_ms << ",\n";
file << " \"grid_render_ms\": " << std::setprecision(3) << f.grid_render_ms << ",\n";
file << " \"entity_render_ms\": " << std::setprecision(3) << f.entity_render_ms << ",\n";
file << " \"python_time_ms\": " << std::setprecision(3) << f.python_time_ms << ",\n";