summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDenis Steckelmacher <steckdenis@yahoo.fr>2011-06-13 16:01:17 +0200
committerDenis Steckelmacher <steckdenis@yahoo.fr>2011-06-13 16:01:17 +0200
commitce6b5986c64f785b34974fa82d8c6dd7e59eac24 (patch)
tree0d00326c6ac453a7712d6ce067ff36689b09dcaa /tests
parent7f30830d30ae01e46e0670df8f732fd4a214ae03 (diff)
Implement profiling
Diffstat (limited to 'tests')
-rw-r--r--tests/test_commandqueue.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/test_commandqueue.cpp b/tests/test_commandqueue.cpp
index 46ac8b8..49f24a3 100644
--- a/tests/test_commandqueue.cpp
+++ b/tests/test_commandqueue.cpp
@@ -205,7 +205,7 @@ START_TEST (test_events)
"unable to create a valid context"
);
- queue = clCreateCommandQueue(ctx, device, 0, &result);
+ queue = clCreateCommandQueue(ctx, device, CL_QUEUE_PROFILING_ENABLE, &result);
fail_if(
result != CL_SUCCESS || queue == 0,
"cannot create a command queue"
@@ -299,6 +299,26 @@ START_TEST (test_events)
"we cannot call clSetUserEventStatus two times for an event"
);
+ // Get timing information about the event
+ cl_ulong timing_queued, timing_submit, timing_start, timing_end;
+
+ result = clGetEventProfilingInfo(write_event, CL_PROFILING_COMMAND_QUEUED,
+ sizeof(cl_ulong), &timing_queued, 0);
+ result |= clGetEventProfilingInfo(write_event, CL_PROFILING_COMMAND_SUBMIT,
+ sizeof(cl_ulong), &timing_submit, 0);
+ result |= clGetEventProfilingInfo(write_event, CL_PROFILING_COMMAND_START,
+ sizeof(cl_ulong), &timing_start, 0);
+ result |= clGetEventProfilingInfo(write_event, CL_PROFILING_COMMAND_END,
+ sizeof(cl_ulong), &timing_end, 0);
+ fail_if(
+ result != CL_SUCCESS,
+ "unable to get timing information about a profiling-enabled event"
+ );
+ fail_if(
+ !(timing_queued <= timing_submit <= timing_start <= timing_end),
+ "something went wrong with the timings : they are unordered"
+ );
+
clReleaseEvent(write_event);
clReleaseEvent(user_event);
clReleaseCommandQueue(queue);