Class: Tracemake::Span

Inherits:
Struct
  • Object
show all
Defined in:
lib/tracemake.rb

Overview

Represents a time span for a command execution

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command

Returns:

  • (Object)

    the current value of command



13
14
15
# File 'lib/tracemake.rb', line 13

def command
  @command
end

#pidObject

Returns the value of attribute pid

Returns:

  • (Object)

    the current value of pid



13
14
15
# File 'lib/tracemake.rb', line 13

def pid
  @pid
end

#sidObject

Returns the value of attribute sid

Returns:

  • (Object)

    the current value of sid



13
14
15
# File 'lib/tracemake.rb', line 13

def sid
  @sid
end

#startObject

Returns the value of attribute start

Returns:

  • (Object)

    the current value of start



13
14
15
# File 'lib/tracemake.rb', line 13

def start
  @start
end

#stopObject

Returns the value of attribute stop

Returns:

  • (Object)

    the current value of stop



13
14
15
# File 'lib/tracemake.rb', line 13

def stop
  @stop
end

Instance Method Details

#b_eventObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tracemake.rb', line 20

def b_event
  {
    "name" => name,
    "ph" => "B",
    "ts" => start * 1_000_000,
    "pid" => 0,
    "tid" => sid,
    "args" => {
      "command" => command
    }
  }
end

#e_eventObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/tracemake.rb', line 33

def e_event
  {
    "name" => name,
    "ph" => "E",
    "ts" => stop * 1_000_000,
    "pid" => 0,
    "tid" => sid,
    "args" => {}
  }
end

#nameObject



14
15
16
17
18
# File 'lib/tracemake.rb', line 14

def name
  _command = command
  _command = command[1..-1] if command[0] == "-c"
  _command.join(" ")
end