Save baseline to file
| 521 | |
| 522 | // Save baseline to file |
| 523 | void save_baseline(const BaselineData &data) |
| 524 | { |
| 525 | std::ofstream file(g_config.baseline_file); |
| 526 | if (!file) |
| 527 | { |
| 528 | std::cerr << "Error: Could not open baseline file for writing: " << g_config.baseline_file << std::endl; |
| 529 | return; |
| 530 | } |
| 531 | |
| 532 | // Simple JSON format |
| 533 | file << "{\n"; |
| 534 | file << " \"accuracy_error_percent\": " << data.accuracy_error_percent << ",\n"; |
| 535 | file << " \"accuracy_error_ms_per_event\": " << data.accuracy_error_ms_per_event << ",\n"; |
| 536 | file << " \"overhead_percent\": " << data.overhead_percent << ",\n"; |
| 537 | file << " \"overhead_ms\": " << data.overhead_ms << ",\n"; |
| 538 | file << " \"overhead_ns_per_event\": " << data.overhead_ns_per_event << ",\n"; |
| 539 | file << " \"memory_bytes_per_event\": " << data.memory_bytes_per_event << ",\n"; |
| 540 | file << " \"calculation_time_ms\": " << data.calculation_time_ms << ",\n"; |
| 541 | file << " \"peak_calc_memory_mb\": " << data.peak_calc_memory_mb << ",\n"; |
| 542 | file << " \"total_events\": " << data.total_events << ",\n"; |
| 543 | file << " \"thread_count\": " << data.thread_count << ",\n"; |
| 544 | file << " \"timestamp\": \"" << data.timestamp << "\",\n"; |
| 545 | file << " \"platform\": \"" << data.platform << "\"\n"; |
| 546 | file << "}\n"; |
| 547 | |
| 548 | std::cout << "\nBaseline saved to: " << g_config.baseline_file << std::endl; |
| 549 | } |
| 550 | |
| 551 | // Load baseline from file |
| 552 | bool load_baseline(BaselineData &data) |