Sha256: be582dc26b2a711ac2ae6c14fad23542a338c83e5e952bdcf67eb550ff02ce7c

Contents?: true

Size: 995 Bytes

Versions: 1

Compression:

Stored size: 995 Bytes

Contents

module ActionLogic
  module ActionBenchmark
    class DefaultFormatter
      def initialize(benchmark_log: ActionConfiguration.benchmark_log)
        @benchmark_log = benchmark_log
      end

      def format(benchmark_result, context_name)
        benchmark_log.printf("%-10s %-50s %-10s %-10f %-10s %-10f %-10s %-10f %-10s %-10f\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

      alias_method :coordinator, :format
      alias_method :use_case, :format
      alias_method :task, :format

      private
      attr_reader :benchmark_log
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
action_logic-0.2.4 lib/action_logic/action_benchmark/default_formatter.rb