Skip to content

Commit

Permalink
Trace general
Browse files Browse the repository at this point in the history
  • Loading branch information
TApplencourt committed Sep 11, 2023
1 parent cf3cffa commit 8435cfd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions utils/babeltrace_thapi.in
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ def get_components(names)
require 'babeltrace_ze_lib' if $options[:backends].include?('ze')
require 'babeltrace_cuda_lib' if $options[:backends].include?('cuda')
require 'babeltrace_hip_lib' if $options[:backends].include?('hip')
# I guess need to put it in `babeltrace_energy_lib` at some point?
$energies={}
$event_lambdas["lttng_ust_ze_sampling:gpu_energy"] = lambda { |defi|
energy = defi['energy']
timestamp = defi['timestamp']
key = [ defi['hDevice'], defi['domain'] ]
previous = $energies[key]
if previous
p_energy, p_timestamp = previous
puts "#{key[0]}:#{key[1]}: #{(energy - p_energy).to_f/(timestamp - p_timestamp)}"
end
$energies[key] = [energy, timestamp]
}

f = lambda { |iterator, _|
iterator.next_messages.each do |m|
next unless m.type == :BT_MESSAGE_TYPE_EVENT
Expand Down

0 comments on commit 8435cfd

Please sign in to comment.