Skip to content

Commit

Permalink
Smaller energy thapi (#148)
Browse files Browse the repository at this point in the history
* Trace general

* Remove files

* Guard

* Update babeltrace_thapi.in

* Fix error

---------

Co-authored-by: Thomas Applencourt <[email protected]>
  • Loading branch information
TApplencourt and Thomas Applencourt authored Sep 11, 2023
1 parent 86490b8 commit f93006a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 125 deletions.
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ AC_CONFIG_FILES([ze/test_wrapper.sh], [chmod +x ze/test_wrapper.sh])
AC_CONFIG_FILES([cuda/tracer_cuda.sh], [chmod +x cuda/tracer_cuda.sh])
AC_CONFIG_FILES([cuda/test_wrapper.sh], [chmod +x cuda/test_wrapper.sh])
AC_CONFIG_FILES([xprof/test_wrapper.sh], [chmod +x xprof/test_wrapper.sh])
AC_CONFIG_FILES([utils/babeltrace_energy], [chmod +x utils/babeltrace_energy])
AC_CONFIG_FILES([utils/babeltrace_thapi], [chmod +x utils/babeltrace_thapi])
AC_CONFIG_FILES([omp/tracer_omp.sh], [chmod +x omp/tracer_omp.sh])
AC_CONFIG_FILES([hip/tracer_hip.sh], [chmod +x hip/tracer_hip.sh])
Expand Down
3 changes: 1 addition & 2 deletions utils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ thapi_metadata_LDFLAGS = $(LTTNG_UST_LIBS)
bin_PROGRAMS = thapi_metadata

bin_SCRIPTS = \
babeltrace_thapi \
babeltrace_energy
babeltrace_thapi

.PHONY: version

Expand Down
122 changes: 0 additions & 122 deletions utils/babeltrace_energy.in

This file was deleted.

19 changes: 19 additions & 0 deletions utils/babeltrace_thapi.in
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,25 @@ 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]
$energies[key] = [energy, timestamp]

if previous
p_energy, p_timestamp = previous
"#{key[0]}:#{key[1]}: #{(energy - p_energy).to_f/(timestamp - p_timestamp)}"
else
""
end
} if $options[:backends].include?('ze')

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

0 comments on commit f93006a

Please sign in to comment.