Class: RegoValidate::Profiler::Sample

Inherits:
Struct
  • Object
show all
Defined in:
lib/ruby/rego/cli.rb,
lib/ruby/rego/cli.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



506
507
508
# File 'lib/ruby/rego/cli.rb', line 506

def allocations
  @allocations
end

#duration_msObject

Returns the value of attribute duration_ms

Returns:

  • (Object)

    the current value of duration_ms



506
507
508
# File 'lib/ruby/rego/cli.rb', line 506

def duration_ms
  @duration_ms
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



506
507
508
# File 'lib/ruby/rego/cli.rb', line 506

def label
  @label
end

#memory_bytesObject

Returns the value of attribute memory_bytes

Returns:

  • (Object)

    the current value of memory_bytes



506
507
508
# File 'lib/ruby/rego/cli.rb', line 506

def memory_bytes
  @memory_bytes
end

#top_objectsObject

Returns the value of attribute top_objects

Returns:

  • (Object)

    the current value of top_objects



506
507
508
# File 'lib/ruby/rego/cli.rb', line 506

def top_objects
  @top_objects
end

Instance Method Details

#report_lineObject



510
511
512
513
514
515
516
517
# File 'lib/ruby/rego/cli.rb', line 510

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

#top_objects_lineObject



519
520
521
522
523
# File 'lib/ruby/rego/cli.rb', line 519

def top_objects_line
  return nil if top_objects.empty?

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