Profiling Info for a command?

hi Folks,
I am trying to measure the execution time of a command using profiling info.
This is my code
cl_event profEvent;
cl_ulong timeStart,timeStop;
ciErr=clEnqueueNDRangeKernel(cqCommandQueue,ckKernel,1,NULL,&szGlobalWorkSize,NULL,0,NULL,profEvent);
ciErr=clWaitForEvents(1,&profEvent);
clGetEventProfilingInfo(profEvent,CL_PROFILING_COMMAND_END,sizeof(timeStop),&timeStop,NULL);
clGetEventProfilingInfo(profEvent,CL_PROFILING_COMMAND_START,sizeof(timeStart),&timeStart,NULL);
printf("
start=%ld",timeStart);
printf("
stop=%ld",timeStop);
printf("
Time after profiling in SUB is %Ld",timeStart-timeStop);
As per the stuff found over net, this should work fine, but I am getting the following output
start=6492816
stop=0
Time after profiling in SUB is 6492816

error -58 in NDRANget

Now -58 indicates invalid event and I am unable to figure this thing out how to get the event working?
Please show me how to correct this problem?

Thanks
Piyush

Piyush,

A couple of comments:

  • It looks like you are missing an ampersand in your clEnqueueNDRangeKernel call. The last parameter to that function is a pointer to a cl_event, not the cl_event directly.
  • Make sure you create the command queue with the CL_QUEUE_PROFILING_ENABLE flag. Perhaps you’re already doing this already, just want to make sure…

Hope this helps!

Aaron