Class: LLMBench::Tracker
- Inherits:
-
Object
- Object
- LLMBench::Tracker
- Defined in:
- lib/llm_bench/tracker.rb
Instance Method Summary collapse
-
#initialize(config_manager:, interval: 600, output_file: nil) ⇒ Tracker
constructor
A new instance of Tracker.
- #start_tracking ⇒ Object
Constructor Details
#initialize(config_manager:, interval: 600, output_file: nil) ⇒ Tracker
Returns a new instance of Tracker.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/llm_bench/tracker.rb', line 7 def initialize(config_manager:, interval: 600, output_file: nil) @config_manager = config_manager @config = config_manager.config @csv_file = output_file || "llm_benchmark_results_#{Time.now.strftime("%Y%m%d_%H%M%S")}.csv" @running = true @next_run_time = Time.now @interval = interval @results_formatter = ResultsFormatter.new(print_result: false) setup_signal_handlers end |
Instance Method Details
#start_tracking ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/llm_bench/tracker.rb', line 18 def start_tracking puts Colors.header("=== LLM Performance Tracker ===") puts Colors.info("Tracking all models every #{interval} seconds") puts Colors.info("Results will be saved to: #{csv_file}") puts Colors.highlight("Press Ctrl+C to stop tracking") puts initialize_csv run_tracking_cycle while running time_until_next_run = next_run_time - Time.now if time_until_next_run.positive? sleep_time = [time_until_next_run, 1.0].min sleep(sleep_time) else run_tracking_cycle @next_run_time = Time.now + interval end end puts "\n#{Colors.warning('Tracking stopped by user')}" puts Colors.info("Results saved to: #{csv_file}") end |