Class: ServerScripts::Parser::StarpuProfile
- Inherits:
-
Object
- Object
- ServerScripts::Parser::StarpuProfile
- Defined in:
- lib/server_scripts/parser/starpu_profile.rb
Instance Attribute Summary collapse
-
#time_hash ⇒ Object
readonly
The Hash containing the time records of various workers and processes.
Instance Method Summary collapse
-
#initialize(regex) ⇒ StarpuProfile
constructor
Specify the regex that will allow finding the profile files for the given starpu processes.
-
#proc_time(event:, proc_id:) ⇒ Object
Get the total time for an event summed over all the workers in a given process.
-
#time(event:, proc_id:, worker_id:) ⇒ Object
Get the time in seconds for the given event, worker and process.
-
#total_exec_time ⇒ Object
Get the sum of exec total time in seconds summed over all processes and workers.
-
#total_overhead_time ⇒ Object
Get the sum of overhead total time in seconds summed over all processes and workers.
-
#total_sleep_time ⇒ Object
Get the sum of sleep total time in seconds summed over all processes and workers.
-
#total_time ⇒ Object
Get the sum of total time in seconds summed over all processes and workers.
Constructor Details
#initialize(regex) ⇒ StarpuProfile
Specify the regex that will allow finding the profile files for the given starpu processes. Each process will output one file.
Usage:
parser = Parser::StarpuProfile.new("4_proc_profile_1_*.starpu_profile")
parser.total_time
14 15 16 17 18 19 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 14 def initialize regex @regex = regex @time_hash = {} extract_data_from_profiles raise ArgumentError, "could not find any starpu profiles." if @time_hash.empty? end |
Instance Attribute Details
#time_hash ⇒ Object (readonly)
The Hash containing the time records of various workers and processes.
6 7 8 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 6 def time_hash @time_hash end |
Instance Method Details
#proc_time(event:, proc_id:) ⇒ Object
Get the total time for an event summed over all the workers in a given process.
42 43 44 45 46 47 48 49 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 42 def proc_time event:, proc_id: time = 0.0 @time_hash[proc_id].each_value do |thread_info| time += thread_info[event] end time end |
#time(event:, proc_id:, worker_id:) ⇒ Object
Get the time in seconds for the given event, worker and process.
:event can be one of :total_time, :exec_time, :sleep_time or :overhead_time. :proc_id should be a number specifying process number. :worker_id should be a number specifying the worker ID.
56 57 58 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 56 def time event:, proc_id:, worker_id: @time_hash[proc_id][worker_id][event] end |
#total_exec_time ⇒ Object
Get the sum of exec total time in seconds summed over all processes and workers.
27 28 29 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 27 def total_exec_time extract_from_time_hash :exec_time end |
#total_overhead_time ⇒ Object
Get the sum of overhead total time in seconds summed over all processes and workers.
37 38 39 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 37 def total_overhead_time extract_from_time_hash :overhead_time end |
#total_sleep_time ⇒ Object
Get the sum of sleep total time in seconds summed over all processes and workers.
32 33 34 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 32 def total_sleep_time extract_from_time_hash :sleep_time end |
#total_time ⇒ Object
Get the sum of total time in seconds summed over all processes and workers.
22 23 24 |
# File 'lib/server_scripts/parser/starpu_profile.rb', line 22 def total_time extract_from_time_hash :total_time end |