Class: RegoValidate::Profiler::Sample

Inherits:
Struct
  • Object
show all
Defined in:
lib/ruby/rego/cli/profiling.rb,
lib/ruby/rego/cli/profiling.rb

Overview

Rendering helpers for profiler samples.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allocationsObject

Returns the value of attribute allocations

Returns:

  • (Object)

    the current value of allocations



8
9
10
# File 'lib/ruby/rego/cli/profiling.rb', line 8

def allocations
  @allocations
end

#duration_msObject

Returns the value of attribute duration_ms

Returns:

  • (Object)

    the current value of duration_ms



8
9
10
# File 'lib/ruby/rego/cli/profiling.rb', line 8

def duration_ms
  @duration_ms
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



8
9
10
# File 'lib/ruby/rego/cli/profiling.rb', line 8

def label
  @label
end

#memory_bytesObject

Returns the value of attribute memory_bytes

Returns:

  • (Object)

    the current value of memory_bytes



8
9
10
# File 'lib/ruby/rego/cli/profiling.rb', line 8

def memory_bytes
  @memory_bytes
end

#top_objectsObject

Returns the value of attribute top_objects

Returns:

  • (Object)

    the current value of top_objects



8
9
10
# File 'lib/ruby/rego/cli/profiling.rb', line 8

def top_objects
  @top_objects
end

Instance Method Details

#report_lineObject



12
13
14
15
16
17
18
19
# File 'lib/ruby/rego/cli/profiling.rb', line 12

def report_line
  parts = [
    "  #{label}: #{format_duration}",
    "allocs +#{allocations}",
    "mem #{format_bytes}"
  ]
  parts.join(", ")
end

#top_objects_lineObject



21
22
23
24
25
# File 'lib/ruby/rego/cli/profiling.rb', line 21

def top_objects_line
  return nil if top_objects.empty?

  "  top allocations: #{top_objects.join(", ")}"
end