class ServerScripts::Parser::VTune::Hotspots::Threads

Parse a file with a hotspots report and grouped by threads. This class is made for parsing things from a single node, multi threaded execution. CSV delimiter should be a comma.

Example command: vtune -collect threading -report hotspots -group-by thread -csv-delimiter=, a.out 65536

Public Instance Methods

time(event:, tid: @threads[tid][event]) click to toggle source

Get time for a particular event in a particular thread.

# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 14
def time event:, tid:
  @threads[tid][event]
end
total_cpu_effective_time() click to toggle source

Total Effective CPU time.

# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 30
def total_cpu_effective_time
  @total_cpu_effective_time ||= parse_for_event(:cpu_effective_time)
  @total_cpu_effective_time
end
total_cpu_overhead_time() click to toggle source

Total CPU overhead: “CPU Time:Overhead Time”

# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 36
def total_cpu_overhead_time
  @total_cpu_overhead_time ||= parse_for_event(:cpu_overhead_time)
  @total_cpu_overhead_time
end
total_cpu_spin_time() click to toggle source

Total CPU Spin time: “CPU Time:Spin Time”. This includes the MPI busy wait time, which for some reason is classified under this banner by vtune.

# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 43
def total_cpu_spin_time
  @total_cpu_spin_time ||= parse_for_event(:cpu_spin_time)
  @total_cpu_spin_time
end
total_cpu_time() click to toggle source

Total CPU time of all the threads. Does not include the wait time.

# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 24
def total_cpu_time
  @total_cpu_time ||= parse_for_event(:cpu_time)
  @total_cpu_time
end
total_time() click to toggle source

Sum of total CPU and wait time.

# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 19
def total_time
  total_cpu_time + total_wait_time
end
total_wait_time() click to toggle source

Total Wait Time.

# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 49
def total_wait_time
  @total_wait_time ||= parse_for_event(:wait_time)
  @total_wait_time            
end

Private Instance Methods

parse_csv!(fname) click to toggle source
# File lib/server_scripts/parser/vtune/hotspots/threads.rb, line 56
def parse_csv! fname
  data = CSV.parse(File.read(fname), headers: true)
  data.each_with_index do |row, i|
    @threads[i] = {}
    @threads[i][:cpu_time] = data[CPU_TIME][i].to_f
    @threads[i][:cpu_effective_time] = data[CPU_EFFECTIVE_TIME][i].to_f
    @threads[i][:cpu_overhead_time] = data[CPU_OVERHEAD_TIME][i].to_f
    @threads[i][:cpu_spin_time] = data[CPU_SPIN_TIME][i].to_f
    @threads[i][:wait_time] = data[WAIT_TIME][i].to_f
  end
end