Class: TWPipeline::Bench::Sample

Inherits:
Data
  • Object
show all
Defined in:
lib/twpipeline/bench.rb,
sig/twpipeline.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cpu_secondsObject (readonly)

Returns the value of attribute cpu_seconds

Returns:

  • (Object)

    the current value of cpu_seconds



9
10
11
# File 'lib/twpipeline/bench.rb', line 9

def cpu_seconds
  @cpu_seconds
end

#factsObject (readonly)

Returns the value of attribute facts

Returns:

  • (Object)

    the current value of facts



9
10
11
# File 'lib/twpipeline/bench.rb', line 9

def facts
  @facts
end

#labelObject (readonly)

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



9
10
11
# File 'lib/twpipeline/bench.rb', line 9

def label
  @label
end

#peak_rss_bytesObject (readonly)

Returns the value of attribute peak_rss_bytes

Returns:

  • (Object)

    the current value of peak_rss_bytes



9
10
11
# File 'lib/twpipeline/bench.rb', line 9

def peak_rss_bytes
  @peak_rss_bytes
end

#secondsObject (readonly)

Returns the value of attribute seconds

Returns:

  • (Object)

    the current value of seconds



9
10
11
# File 'lib/twpipeline/bench.rb', line 9

def seconds
  @seconds
end

Instance Method Details

#cores_used::Float

Returns:

  • (::Float)


10
# File 'lib/twpipeline/bench.rb', line 10

def cores_used = seconds.zero? ? 0.0 : cpu_seconds / seconds

#to_h::Hash[::Symbol, untyped]

Returns:

  • (::Hash[::Symbol, untyped])


12
13
14
15
16
17
18
19
20
# File 'lib/twpipeline/bench.rb', line 12

def to_h
  {
    label: label,
    seconds: seconds.round(3),
    cpu_seconds: cpu_seconds.round(3),
    cores_used: cores_used.round(2),
    peak_rss_bytes: peak_rss_bytes
  }.merge(facts)
end