OpenCL event profiling - is it reliable?

Hello,

I’m trying to get execution time for a simple OpenCL kernel but each time I run my program I get very different values. This is my code:

cl_command_queue_properties props = {CL_QUEUE_PROFILING_ENABLE};
q = clCreateCommandQueueWithProperties(c, deviceId, props, &errorCode);
cl_event event;
cl_ulong startTime, endTime;
// add kernel to cmd queue
clWaitForEvents(1, &event);
clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_START, sizeof(cl_ulong), &startTime, NULL);
clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_END, sizeof(cl_ulong), &endTime, NULL);
cl_ulong elapsedTime = endTime - startTime;
printf("kernel elapsed time: %lu nanosecond\n", elapsedTime);

Every time I run my code I get very different measurements, for example 8, 103436 or 18446744071639661079 nanoseconds. Code seems to run OK, results are always the same and program runs quickly every time.

Is there some kind of a trick to this, to making consistent time measurements?

Any help would be much appreciated!