Commit d5e827dd authored by Brice Videau's avatar Brice Videau
Browse files

Refactoring, changed _start and _stop suffix for _entry and _exit respectively.

parent 33db7b7b
Pipeline #11583 failed with stage
......@@ -9,6 +9,10 @@ else
SRC_DIR = "."
end
START = "entry"
STOP = "exit"
SUFFIXES = { :start => START, :stop => STOP }
LTTNG_AVAILABLE_PARAMS = 25
LTTNG_USABLE_PARAMS = LTTNG_AVAILABLE_PARAMS - 1
......
......@@ -9,6 +9,10 @@ else
SRC_DIR = "."
end
START = "entry"
STOP = "exit"
SUFFIXES = { :start => START, :stop => STOP }
LTTNG_AVAILABLE_PARAMS = 25
LTTNG_USABLE_PARAMS = LTTNG_AVAILABLE_PARAMS - 1
......
......@@ -52,7 +52,7 @@ meta_parameter_lambda = lambda { |m, dir|
gen_event_lambda = lambda { |provider, c, dir|
puts <<EOF
$event_lambdas["#{provider}:#{c.name}_#{dir}"] = lambda { |defi|
$event_lambdas["#{provider}:#{c.name}_#{SUFFIXES[dir]}"] = lambda { |defi|
s = "{ "
EOF
fields = []
......
......@@ -110,7 +110,7 @@ common_block = lambda { |c, provider|
puts p.init unless p.after?
}
puts <<EOF
tracepoint(#{provider}, #{c.name}_start, #{(tp_params+tracepoint_params).join(", ")});
tracepoint(#{provider}, #{c.name}_#{START}, #{(tp_params+tracepoint_params).join(", ")});
EOF
c.prologues.each { |p|
......@@ -135,7 +135,7 @@ EOF
tp_params.push "_retval"
end
puts <<EOF
tracepoint(#{provider}, #{c.name}_stop, #{(tp_params+tracepoint_params).join(", ")});
tracepoint(#{provider}, #{c.name}_#{STOP}, #{(tp_params+tracepoint_params).join(", ")});
EOF
}
......
......@@ -57,7 +57,7 @@ common_block = lambda { |c, provider|
puts p.init
}
puts <<EOF
tracepoint(#{provider}, #{c.name}_start, #{(tp_params+tracepoint_params).join(", ")});
tracepoint(#{provider}, #{c.name}_#{START}, #{(tp_params+tracepoint_params).join(", ")});
EOF
c.prologues.each { |p|
......@@ -79,7 +79,7 @@ EOF
tp_params.push "_retval"
end
puts <<EOF
tracepoint(#{provider}, #{c.name}_stop, #{(tp_params+tracepoint_params).join(", ")});
tracepoint(#{provider}, #{c.name}_#{STOP}, #{(tp_params+tracepoint_params).join(", ")});
EOF
}
......
......@@ -4,7 +4,7 @@ $tracepoint_lambda = lambda { |provider, c, dir|
puts <<EOF
TRACEPOINT_EVENT(
#{provider},
#{c.name}_#{dir},
#{c.name}_#{SUFFIXES[dir]},
TP_ARGS(
EOF
print " "
......
......@@ -12,6 +12,9 @@ raise "Trace not found: #{ARGV[0].inspect}, check path." if traces == []
puts "#{c.get_timestamp_begin.strftime("%Y-%m-%d %H:%M:%S.%9L %z")} -- #{c.get_timestamp_end.strftime("%Y-%m-%d %H:%M:%S.%9L %z")}"
opencl_model = YAML::load_file(File.join(DATADIR,"opencl_model.yaml"))
SUFFIXES = opencl_model["suffixes"]
START = SUFFIXES["start"]
STOP = SUFFIXES["stop"]
infos = YAML::load_file(File.join(DATADIR,"opencl_infos.yaml"))
enums_by_type = {}
enums_by_value = {}
......@@ -181,9 +184,9 @@ EOF
src << v.collect { |name, desc|
expr =
if name == "param_value_vals"
startn = n.gsub("_stop", "_start")
startn = n.gsub("_#{STOP}", "_#{START}")
type = opencl_model["events"][startn]["param_name"]["type"]
if n == "lttng_ust_opencl:clSetKernelExecInfo_start"
if n == "lttng_ust_opencl:clSetKernelExecInfo_#{START}"
"begin if defi[\"#{name}\"].size > 0 && infos_type[\"#{type}\"] then i = infos_type[\"#{type}\"][defi[\"param_name\"]]; if i then v = defi[\"#{name}\"].unpack(i[0]); v.collect! { |j| j.to_s(16) } if i[0].match(\"J\"); v = v.first unless i[1]; v; else defi[\"#{name}\"]; end; else defi[\"#{name}\"]; end; end"
else
"begin if defi[\"#{name}\"].size > 0 && infos_type[\"#{type}\"] then i = infos_type[\"#{type}\"][defi[\"_param_name\"]]; if i then v = defi[\"#{name}\"].unpack(i[0]); v.collect! { |j| j.to_s(16) } if i[0].match(\"J\"); v = v.first unless i[1]; v; else defi[\"#{name}\"]; end; else defi[\"#{name}\"]; end; end"
......
......@@ -49,9 +49,9 @@ static void clprof_<%= dbt_event.name %>_callback(
<%if dbt_event.name_unsanitized.start_with?('lttng_ust_opencl:') %>
int64_t ns_from_origin;
bt_clock_snapshot_get_ns_from_origin(bt_clock, &ns_from_origin);
<%if dbt_event.name.end_with?("start") %>
<%if dbt_event.name.end_with?(START) %>
api_call[hpt_function_name_t(hostname,process_id, thread_id, "<%= dbt_event.name_striped %>")].start(ns_from_origin);
<%elsif dbt_event.name.end_with?("stop") %>
<%elsif dbt_event.name.end_with?(STOP) %>
api_call[hpt_function_name_t(hostname,process_id, thread_id, "<%= dbt_event.name_striped %>")].stop(ns_from_origin);
<% if dbt_event.fields.key?('errcode_ret_val') %>
if (errcode_ret_val != 0)
......@@ -79,16 +79,16 @@ static void clprof_<%= dbt_event.name %>_callback(
%>
<%# Map [ Tuple [hostname, process, device_or_subdevice], device] ] %>
<% if dbt_event.name_unsanitized == "lttng_ust_opencl:clGetDeviceIDs_stop" %>
<% if dbt_event.name_unsanitized == "lttng_ust_opencl:clGetDeviceIDs_#{STOP}" %>
if (devices_vals != nullptr) {
for (unsigned int i=0; i < num_devices_val; i++ ) {
const thapi_device_id d = (thapi_device_id) devices_vals[i];
device_to_rootdevice[hp_device_t(hostname,process_id, d) ] = d;
}
}
<% elsif dbt_event.name_unsanitized == "lttng_ust_opencl:clCreateSubDevices_start" %>
<% elsif dbt_event.name_unsanitized == "lttng_ust_opencl:clCreateSubDevices_#{START}" %>
start_device[hpt_t(hostname,process_id,thread_id) ] = (thapi_device_id) in_device;
<% elsif dbt_event.name_unsanitized == "lttng_ust_opencl:clCreateSubDevices_stop" %>
<% elsif dbt_event.name_unsanitized == "lttng_ust_opencl:clCreateSubDevices_#{STOP}" %>
const thapi_device_id device = start_device[hpt_t(hostname,process_id,thread_id) ];
const thapi_device_id root_device = device_to_rootdevice[hp_device_t(hostname,process_id, device) ];
if (out_devices_vals != nullptr) {
......@@ -100,9 +100,9 @@ static void clprof_<%= dbt_event.name %>_callback(
<% end%>
<%# Map [ Tuple [ Hostnane, process, cl_command_queue ], Tuple [ device, subdevice] ] %>
<% if dbt_event.name.end_with?("start") and dbt_event.name.include?('clCreateCommandQueue') %>
<% if dbt_event.name.end_with?(START) and dbt_event.name.include?('clCreateCommandQueue') %>
start_device[hpt_t(hostname,process_id, thread_id) ] = (thapi_device_id) device;
<%elsif dbt_event.name.end_with?("stop") and dbt_event.name.include?('clCreateCommandQueue') %>
<%elsif dbt_event.name.end_with?(STOP) and dbt_event.name.include?('clCreateCommandQueue') %>
const thapi_device_id device = start_device[hpt_t(hostname,process_id, thread_id) ];
const thapi_device_id root_device = device_to_rootdevice[hp_device_t(hostname,process_id, device) ];
command_queue_to_device[hp_command_queue_t(hostname,process_id,command_queue)] = dsd_t(root_device, device) ;
......@@ -123,7 +123,7 @@ static void clprof_<%= dbt_event.name %>_callback(
const std::string hostname = borrow_hostname(bt_evt);
const process_id_t process_id = borrow_process_id(bt_evt);
kernel_to_name[hp_kernel_t(hostname,process_id,kernel)] = std::string{function_name};
<% elsif dbt_event.name.end_with?("start") and dbt_event.fields['command_queue'] %>
<% elsif dbt_event.name.end_with?(START) and dbt_event.fields['command_queue'] %>
<% if dbt_event.fields['kernel'] %>
const thapi_function_name name = kernel_to_name[hp_kernel_t(hostname,process_id,kernel)];
<% else %>
......
......@@ -12,6 +12,10 @@ c.add_traces(path: ARGV[0] )
it = c.iter_create
opencl_model = YAML::load_file("opencl_model.yaml")
SUFFIXES = opencl_model["suffixes"]
START = SUFFIXES["start"]
STOP = SUFFIXES["stop"]
def get_enqueues(it)
......@@ -28,26 +32,26 @@ def get_enqueues(it)
next unless defi
v = defi.value
case ev.name
when "lttng_ust_opencl:clCreateProgramWithSource_start"
when "lttng_ust_opencl:clCreateProgramWithSource_#{START}"
program = {}
program[:context] = v["context"]
when "lttng_ust_opencl:clCreateProgramWithIL_start"
when "lttng_ust_opencl:clCreateProgramWithIL_#{START}"
program = {}
program[:context] = v["context"]
program[:type] = :il
when "lttng_ust_opencl_source:program_string", "lttng_ust_opencl_source:program_il"
program[:source] = v["path"]
when "lttng_ust_opencl:clCreateProgramWithIL_stop", "lttng_ust_opencl:clCreateProgramWithSource_stop"
when "lttng_ust_opencl:clCreateProgramWithIL_#{STOP}", "lttng_ust_opencl:clCreateProgramWithSource_#{STOP}"
if v["errcode_ret_val"] == 0
programs[v["program"]] = program
end
program = nil
when "lttng_ust_opencl:clCreateKernel_start"
when "lttng_ust_opencl:clCreateKernel_#{START}"
kernel = {}
kernel[:name] = v["kernel_name_val"]
kernel[:program] = programs[v["program"]]
kernel[:arg_infos] = {}
when "lttng_ust_opencl:clCreateKernel_stop"
when "lttng_ust_opencl:clCreateKernel_#{STOP}"
if v["errcode_ret_val"] == 0
kernels[v["kernel"]] = kernel
end
......@@ -62,7 +66,7 @@ def get_enqueues(it)
else
r[:buff_out] = v["path"]
end
when "lttng_ust_opencl:clEnqueueNDRangeKernel_start"
when "lttng_ust_opencl:clEnqueueNDRangeKernel_#{START}"
res = {}
res[:kernel] = kernels[v["kernel"]]
res[:global_work_size] = v["global_work_size_vals"]
......@@ -74,7 +78,7 @@ def get_enqueues(it)
res2 = enqueues[enqueue_counter]
res.merge!(res2)
end
when "lttng_ust_opencl:clEnqueueNDRangeKernel_stop"
when "lttng_ust_opencl:clEnqueueNDRangeKernel_#{STOP}"
if v["errcode_ret_val"] == 0
enqueues[enqueue_counter] = res
end
......
......@@ -9,40 +9,44 @@ end
opencl_model = YAML::load_file("opencl_model.yaml")
SUFFIXES = opencl_model["suffixes"]
START = SUFFIXES["start"]
STOP = SUFFIXES["stop"]
# Todo. This list is not complete
$cl_type_to_bl_type = {
"cl_platform_id" => "integer_unsigned",
"cl_device_id" => "integer_unsigned",
"cl_context" => "integer_unsigned",
"cl_command_queue" => "integer_unsigned",
"cl_mem" => "integer_unsigned",
"cl_program" => "integer_unsigned",
"cl_kernel" => "integer_unsigned",
"cl_event" => "integer_unsigned",
"cl_sampler" => "integer_unsigned",
"cl_GLsync" => "integer_unsigned",
"CLeglImageKHR" => "integer_unsigned",
"CLeglDisplayKHR" => "integer_unsigned",
"CLeglSyncKHR" => "integer_unsigned",
"cl_accelerator_intel" => "integer_unsigned",
"unsigned int" => "integer_unsigned",
"int" => "integer_signed",
"intptr_t" => "integer_signed",
"uintptr_t" => "integer_unsigned",
"size_t" => "integer_unsigned",
"cl_int" => "integer_signed",
"cl_uint" => "integer_unsigned",
"cl_long" => "integer_signed",
"cl_ulong" => "integer_unsigned",
"cl_short" => "integer_signed",
"cl_ushort" => "integer_unsigned",
"cl_char" => "string",
"cl_uchar" => "string",
"cl_half" => "real_single",
"cl_float" => "real_single",
"cl_double" => "real_double",
'cl_errcode' => 'integer_signed',
'string' => 'string'
"cl_platform_id" => "integer_unsigned",
"cl_device_id" => "integer_unsigned",
"cl_context" => "integer_unsigned",
"cl_command_queue" => "integer_unsigned",
"cl_mem" => "integer_unsigned",
"cl_program" => "integer_unsigned",
"cl_kernel" => "integer_unsigned",
"cl_event" => "integer_unsigned",
"cl_sampler" => "integer_unsigned",
"cl_GLsync" => "integer_unsigned",
"CLeglImageKHR" => "integer_unsigned",
"CLeglDisplayKHR" => "integer_unsigned",
"CLeglSyncKHR" => "integer_unsigned",
"cl_accelerator_intel" => "integer_unsigned",
"unsigned int" => "integer_unsigned",
"int" => "integer_signed",
"intptr_t" => "integer_signed",
"uintptr_t" => "integer_unsigned",
"size_t" => "integer_unsigned",
"cl_int" => "integer_signed",
"cl_uint" => "integer_unsigned",
"cl_long" => "integer_signed",
"cl_ulong" => "integer_unsigned",
"cl_short" => "integer_signed",
"cl_ushort" => "integer_unsigned",
"cl_char" => "string",
"cl_uchar" => "string",
"cl_half" => "real_single",
"cl_float" => "real_single",
"cl_double" => "real_double",
'cl_errcode' => 'integer_signed',
'string' => 'string'
}
class DBT_event
......@@ -65,7 +69,7 @@ class DBT_event
end
def name_striped
@name_unsanitized[/:(.*?)_?(?:start|stop)?$/,1]
@name_unsanitized[/:(.*?)_?(?:#{START}|#{STOP})?$/,1]
end
Payload = Struct.new(:lttng_type,:name)
......@@ -105,92 +109,92 @@ end
l_test_d = [
{"name" => "profiling_normal",
"dust"=> [
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"],
['aurora12.gov',-1,3, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,0,'"clEnqueueReadBuffer"'], 10] ]
},
{"name" => "profiling_inversed",
"dust"=> [
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueWriteBuffer_start'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueWriteBuffer_#{START}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueWriteBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueWriteBuffer_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=5'] ] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,0,'"clEnqueueWriteBuffer"'], 10],
[ ['"aurora12.gov"',-1,2,0,0,'"clEnqueueReadBuffer"'], 5] ]
},
{"name" => "profiling_block",
"dust"=> [ ['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start'],
"dust"=> [ ['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}"],
['aurora12.gov',-1,3, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'] ],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,0,'"clEnqueueReadBuffer"'], 10 ] ]
},
{"name" => "profiling_fast",
"dust"=> [ ['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start'],
"dust"=> [ ['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,3, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'] ],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,0,'"clEnqueueReadBuffer"'], 10] ]
},
{"name" => "profiling_interleave_thread",
"dust"=> [ ['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start'],
['aurora12.gov',-1,3, 'lttng_ust_opencl:clEnqueueWriteBuffer_start'],
"dust"=> [ ['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}"],
['aurora12.gov',-1,3, "lttng_ust_opencl:clEnqueueWriteBuffer_#{START}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,3, 'lttng_ust_opencl_profiling:event_profiling', ['event=20'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'],
['aurora12.gov',-1,3, 'lttng_ust_opencl:clEnqueueWriteBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"],
['aurora12.gov',-1,3, "lttng_ust_opencl:clEnqueueWriteBuffer_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ],
['aurora12.gov',-1,3, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=20'], ['start=0'], ['end=20'] ] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,0,'"clEnqueueReadBuffer"'], 10],
[ ['"aurora12.gov"',-1,3,0,0,'"clEnqueueWriteBuffer"'], 20] ]
},
{"name" => "profiling_interleave_process",
"dust"=> [ ['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start'],
['aurora12.gov', 1,2, 'lttng_ust_opencl:clEnqueueWriteBuffer_start'],
"dust"=> [ ['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}"],
['aurora12.gov', 1,2, "lttng_ust_opencl:clEnqueueWriteBuffer_#{START}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov', 1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'],
['aurora12.gov', 1,2, 'lttng_ust_opencl:clEnqueueWriteBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"],
['aurora12.gov', 1,2, "lttng_ust_opencl:clEnqueueWriteBuffer_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ],
['aurora12.gov', 1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=20'] ] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,0,'"clEnqueueReadBuffer"'], 10],
[ ['"aurora12.gov"', 1,2,0,0,'"clEnqueueWriteBuffer"'], 20] ]
},
{"name" => "profiling_normal_command_queue",
"dust"=> [ ['aurora12.gov',-1,2, 'lttng_ust_opencl:clCreateCommandQueue_start','device=10'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clCreateCommandQueue_stop', 'command_queue=23'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start', 'command_queue=23'],
"dust"=> [ ['aurora12.gov',-1,2, "lttng_ust_opencl:clCreateCommandQueue_#{START}",'device=10'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clCreateCommandQueue_#{STOP}", 'command_queue=23'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}", 'command_queue=23'],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,10,'"clEnqueueReadBuffer"'], 10] ]
},
{"name" => "profiling_with_error",
"dust"=> [ ['aurora12.gov',-1,2, 'lttng_ust_opencl:clCreateCommandQueue_start','device=10'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clCreateCommandQueue_stop', 'command_queue=23'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start', 'command_queue=23'],
"dust"=> [ ['aurora12.gov',-1,2, "lttng_ust_opencl:clCreateCommandQueue_#{START}",'device=10'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clCreateCommandQueue_#{STOP}", 'command_queue=23'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}", 'command_queue=23'],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'], ['queued_status=-58'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueWriteBuffer_start', 'command_queue=23'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueWriteBuffer_#{START}", 'command_queue=23'],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=20'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueWriteBuffer_stop'] ],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueWriteBuffer_#{STOP}"] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,10,'"clEnqueueWriteBuffer"'], 20] ]
},
{"name" => "profiling_normal_command_queue_created_in_other_thread",
"dust"=> [ ['aurora12.gov',-1,3, 'lttng_ust_opencl:clCreateCommandQueue_start','device=10'],
['aurora12.gov',-1,3, 'lttng_ust_opencl:clCreateCommandQueue_stop', 'command_queue=23'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_start', 'command_queue=23'],
"dust"=> [ ['aurora12.gov',-1,3, "lttng_ust_opencl:clCreateCommandQueue_#{START}",'device=10'],
['aurora12.gov',-1,3, "lttng_ust_opencl:clCreateCommandQueue_#{STOP}", 'command_queue=23'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{START}", 'command_queue=23'],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueReadBuffer_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueReadBuffer_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,10,'"clEnqueueReadBuffer"'], 10] ]
},
......@@ -204,17 +208,17 @@ l_test_d = [
},
{"name" => "profiling_normal_nd_range_kernel_name",
"dust"=> [ ['aurora24.gov',-1,3, 'lttng_ust_opencl_arguments:kernel_info', 'function_name=__ompoffload','kernel=12'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueNDRangeKernel_start','kernel=12'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueNDRangeKernel_#{START}",'kernel=12'],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling', ['event=12'] ],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clEnqueueNDRangeKernel_stop'],
['aurora12.gov',-1,2, "lttng_ust_opencl:clEnqueueNDRangeKernel_#{STOP}"],
['aurora12.gov',-1,2, 'lttng_ust_opencl_profiling:event_profiling_results', ['event=12'], ['start=0'], ['end=10'] ] ],
"device_id_result" => [ [ ['"aurora12.gov"',-1,2,0,0,'"__ompoffload"'], 10] ]
},
{ "name" => "API_call",
"dust" => [ ['aurora12.gov',-1,2, 'lttng_ust_opencl:clLinkProgram_start'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clLinkProgram_stop'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clLinkProgram_start'],
['aurora12.gov',-1,2, 'lttng_ust_opencl:clLinkProgram_stop'] ],
"dust" => [ ["aurora12.gov",-1,2, "lttng_ust_opencl:clLinkProgram_#{START}"],
["aurora12.gov",-1,2, "lttng_ust_opencl:clLinkProgram_#{STOP}"],
["aurora12.gov",-1,2, "lttng_ust_opencl:clLinkProgram_#{START}"],
["aurora12.gov",-1,2, "lttng_ust_opencl:clLinkProgram_#{STOP}"] ],
"api_call" => [ [ ['"aurora12.gov"',-1,2, '"clLinkProgram"'], [2,1,1,1.0] ] ]
}
]
......
......@@ -30,6 +30,15 @@ puts <<EOF
#include "opencl_build.h"
#include "opencl_devices.h"
#define CONCAT(c,suf) c ## _ ## suf
#define STARTEV(command) CONCAT(command, #{START})
#define STOPEV(command) CONCAT(command, #{STOP})
#define do_tracepoint_safe(provider, name, ...) \
do_tracepoint(provider, name, __VA_ARGS__)
#define tracepoint_enabled_safe(provider, name) \
tracepoint_enabled(provider, name)
#define tracepoint_safe(provider, name, ...) \
tracepoint(provider, name, __VA_ARGS__)
EOF
$opencl_commands.each { |c|
......@@ -101,7 +110,7 @@ common_block = lambda { |c|
puts p.init
}
puts <<EOF
tracepoint(lttng_ust_opencl, #{c.prototype.name}_start, #{(tp_params+tracepoint_params).join(", ")});
tracepoint(lttng_ust_opencl, #{c.prototype.name}_#{SUFFIXES["start"]}, #{(tp_params+tracepoint_params).join(", ")});
EOF
c.prologues.each { |p|
puts p
......@@ -141,7 +150,7 @@ EOF
tp_params.push "_duration"
end
puts <<EOF
tracepoint(lttng_ust_opencl, #{c.prototype.name}_stop, #{(tp_params+tracepoint_params).join(", ")});
tracepoint(lttng_ust_opencl, #{c.prototype.name}_#{SUFFIXES["stop"]}, #{(tp_params+tracepoint_params).join(", ")});
EOF
}
......
......@@ -45,7 +45,7 @@ en.each { |e|
}
event_lambda = lambda { |c, dir|
name = "lttng_ust_opencl:#{c.prototype.name}_#{dir}"
name = "lttng_ust_opencl:#{c.prototype.name}_#{SUFFIXES[dir]}"
fields = {}
params = {}
c.parameters.each { |p|
......@@ -66,7 +66,7 @@ event_lambda = lambda { |c, dir|
[m.name, m]
}.to_h]
}.to_h
if dir == :start
if dir == "start"
c.parameters.select { |p| p.lttng_in_type }.each { |p|
field = {}
lttng = p.lttng_in_type
......@@ -147,7 +147,7 @@ event_lambda = lambda { |c, dir|
}
($opencl_commands+$opencl_extension_commands).each { |c|
[:start, :stop].each { |dir|
["start", "stop"].each { |dir|
name, val = event_lambda.call(c, dir)
events[name] = val
}
......@@ -156,8 +156,8 @@ event_lambda = lambda { |c, dir|
YAML::load_file(File.join(SRC_DIR,"opencl_wrapper_events.yaml")).each { |namespace, h|
h["events"].each { |e|
["start", "stop"].each { |dir|
event = get_fields(e["args"], e[dir])
events["#{namespace}:#{e["name"]}_#{dir}"] = event
event = get_fields(e["args"], e[dir.to_s])
events["#{namespace}:#{e["name"]}_#{SUFFIXES[dir]}"] = event
}
}
}
......@@ -169,4 +169,6 @@ YAML::load_file(File.join(SRC_DIR,"opencl_events.yaml")).each { |namespace, h|
}
}
res["suffixes"] = SUFFIXES
puts YAML::dump(res)
......@@ -44,12 +44,12 @@ tracepoint_lambda = lambda { |c, dir|
event = {}
event["name"] = c.prototype.name
args = []
unless c.parameters.size == 1 && c.parameters.first.decl.strip == "void" && !((HOST_PROFILE || c.prototype.has_return_type?) && dir == :stop)
unless c.parameters.size == 1 && c.parameters.first.decl.strip == "void" && !((HOST_PROFILE || c.prototype.has_return_type?) && dir == "stop")
args = c.parameters.collect { |p|
[p.callback? ? "void *" : p.decl_pointer.gsub("[]", "*"),
p.name]
} unless c.parameters.size == 1 && c.parameters.first.decl.strip == "void"
if dir == :stop
if dir == "stop"
args.push [c.prototype.return_type, "_retval"] if c.prototype.has_return_type?
args.push ["uint64_t", "_duration"] if HOST_PROFILE
end
......@@ -60,14 +60,14 @@ tracepoint_lambda = lambda { |c, dir|
event["args"] = args
fields = []
if dir == :start
if dir == "start"
c.parameters.collect(&:lttng_in_type).compact.each { |arr|
fields.push arr
}
c.meta_parameters.collect(&:lttng_in_type).compact.each { |arr|
fields.push arr
}
elsif dir == :stop
elsif dir == "stop"
r = c.prototype.lttng_return_type
fields.push r if r
c.meta_parameters.collect(&:lttng_out_type).compact.each { |arr|
......@@ -84,14 +84,14 @@ tracepoint_lambda = lambda { |c, dir|
$opencl_commands.each { |c|
next if c.parameters.length > LTTNG_USABLE_PARAMS
tracepoint_lambda.call(c, :start)
tracepoint_lambda.call(c, :stop)
tracepoint_lambda.call(c, "start")
tracepoint_lambda.call(c, "stop")
}
$opencl_extension_commands.each { |c|
next if c.parameters.length > LTTNG_USABLE_PARAMS
tracepoint_lambda.call(c, :start)
tracepoint_lambda.call(c, :stop)
tracepoint_lambda.call(c,