diff options
author | Ivan Shapovalov <intelfx@intelfx.name> | 2016-10-15 20:11:41 +0300 |
---|---|---|
committer | Ivan Shapovalov <intelfx@intelfx.name> | 2016-10-22 07:25:15 +0300 |
commit | 106565fa9ad1f12df650dbc02bff27bd0b79de6a (patch) | |
tree | 0cc8aa195e14df22bc6655f634ca4df51ed4f12f /src | |
parent | 53deed298facc005f71e9ec2a96d5c4e90d826af (diff) |
src/clpp11.hpp: reinstate error checking on clGetEventProfilingInfo()
Diffstat (limited to 'src')
-rw-r--r-- | src/clpp11.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/clpp11.hpp b/src/clpp11.hpp index aaa76cb4..f6855349 100644 --- a/src/clpp11.hpp +++ b/src/clpp11.hpp @@ -92,16 +92,17 @@ class Event { CheckError(clWaitForEvents(1, &(*event_))); } - // Retrieves the elapsed time of the last recorded event. Note that no error checking is done on - // the 'clGetEventProfilingInfo' function, since there is a bug in Apple's OpenCL implementation: - // http://stackoverflow.com/questions/26145603/clgeteventprofilinginfo-bug-in-macosx + // Retrieves the elapsed time of the last recorded event. + // (Note that there is a bug in Apple's OpenCL implementation of the 'clGetEventProfilingInfo' function: + // http://stackoverflow.com/questions/26145603/clgeteventprofilinginfo-bug-in-macosx) + // However, in our case the reply size is fixed to be cl_ulong, so we are not affected. float GetElapsedTime() const { WaitForCompletion(); const auto bytes = sizeof(cl_ulong); auto time_start = cl_ulong{0}; - clGetEventProfilingInfo(*event_, CL_PROFILING_COMMAND_START, bytes, &time_start, nullptr); + CheckError(clGetEventProfilingInfo(*event_, CL_PROFILING_COMMAND_START, bytes, &time_start, nullptr)); auto time_end = cl_ulong{0}; - clGetEventProfilingInfo(*event_, CL_PROFILING_COMMAND_END, bytes, &time_end, nullptr); + CheckError(clGetEventProfilingInfo(*event_, CL_PROFILING_COMMAND_END, bytes, &time_end, nullptr)); return static_cast<float>(time_end - time_start) * 1.0e-6f; } |