Class: ActionLogic::ActionBenchmark::DefaultFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/action_logic/action_benchmark/default_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(benchmark_log: ActionLogic.benchmark_log) ⇒ DefaultFormatter

Returns a new instance of DefaultFormatter.



4
5
6
# File 'lib/action_logic/action_benchmark/default_formatter.rb', line 4

def initialize(benchmark_log: ActionLogic.benchmark_log)
  @benchmark_log = benchmark_log
end

Instance Method Details

#format(benchmark_result, context_name) ⇒ Object Also known as: log_coordinator, log_use_case, log_task



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/action_logic/action_benchmark/default_formatter.rb', line 8

def format(benchmark_result, context_name)
  benchmark_log.printf("%s%s %s%f %s%f %s%f %s%f\n",
                       "context:",
                       context_name,
                       "user_time:",
                       benchmark_result.utime,
                       "system_time:",
                       benchmark_result.stime,
                       "total_time:",
                       benchmark_result.total,
                       "real_time:",
                       benchmark_result.real)
end