Commit 9509b497 authored by Brice Videau's avatar Brice Videau

Merge branch 'device-timer' into 'master'

Added new event to dump device timer when available.

See merge request !7
parents 3b9d82f0 f7f20104
Pipeline #12270 failed with stage
......@@ -243,3 +243,12 @@ lttng_ust_opencl_devices:
fields:
- [ ctf_integer_hex, uintptr_t, device, "(uintptr_t)device" ]
- [ ctf_string, name, name ]
- name: device_timer
args:
- [ cl_device_id, device ]
- [ cl_ulong, device_timestamp ]
- [ cl_ulong, host_timestamp ]
fields:
- [ ctf_integer_hex, uintptr_t, device, "(uintptr_t)device" ]
- [ ctf_integer, cl_ulong, device_timestamp, device_timestamp ]
- [ ctf_integer, cl_ulong, host_timestamp, host_timestamp ]
......@@ -1150,8 +1150,14 @@ EOF
register_prologue "clGetDeviceIDs", <<EOF
cl_uint n_e;
if (tracepoint_enabled(lttng_ust_opencl_devices, device_name) && !num_devices && devices) {
num_devices = &n_e;
}
num_devices = &n_e;
}
EOF
register_prologue "clGetDeviceIDs", <<EOF
if (tracepoint_enabled(lttng_ust_opencl_devices, device_timer) && !num_devices && devices) {
num_devices = &n_e;
}
EOF
register_epilogue "clGetDeviceIDs", <<EOF
......@@ -1162,6 +1168,14 @@ register_epilogue "clGetDeviceIDs", <<EOF
}
EOF
register_epilogue "clGetDeviceIDs", <<EOF
if (tracepoint_enabled(lttng_ust_opencl_devices, device_timer) && _retval == CL_SUCCESS && devices) {
for (cl_uint i = 0; i < *num_devices; i++) {
dump_device_timer(devices[i]);
}
}
EOF
str = $opencl_commands.select{ |c| c.extension? }.collect { |c|
<<EOF
if (strcmp(func_name, "#{c.prototype.name}") == 0) {
......
......@@ -23,7 +23,7 @@ struct opencl_version {
//static const struct opencl_version opencl_version_1_1 = {1, 1};
static const struct opencl_version opencl_version_1_2 = {1, 2};
//static const struct opencl_version opencl_version_2_0 = {2, 0};
//static const struct opencl_version opencl_version_2_1 = {2, 1};
static const struct opencl_version opencl_version_2_1 = {2, 1};
//static const struct opencl_version opencl_version_2_2 = {2, 2};
static inline int compare_opencl_version(const struct opencl_version *v1, const struct opencl_version *v2) {
......@@ -759,6 +759,19 @@ cleanup:
free(name);
}
static inline void dump_device_timer(cl_device_id device) {
struct opencl_version version = {1, 0};
get_device_platform_version(device, &version);
if (compare_opencl_version(&version, &opencl_version_2_1) >= 0) {
cl_ulong device_timestamp;
cl_ulong host_timestamp;
if (CL_GET_DEVICE_AND_HOST_TIMER_PTR(device, &device_timestamp, &host_timestamp) != CL_SUCCESS)
return;
do_tracepoint(lttng_ust_opencl_devices, device_timer, device, device_timestamp, host_timestamp);
}
}
static inline void dump_program_device_build_infos(cl_program program, cl_device_id device) {
cl_build_status build_status;
char *build_options = "";
......
......@@ -73,7 +73,7 @@ trace_and_summary() {
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_build:infos*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_profiling:*
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_arguments:kernel_info
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_devices:device_name
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_opencl_devices:*
<% end %>
<% if languages.include?("ze") %>
lttng $quiet enable-event --channel=blocking-channel --userspace lttng_ust_ze:*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment