Commit aed69cc4 authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #1882 from philippefoubert:branch_ocl_instrumentation

parents b27d7d2a ec6f2e1c
......@@ -658,8 +658,11 @@ void ContextImpl::setContext(const DeviceInfo* deviceInfo)
cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)(infoImpl.platform_id), 0 };
cl_context clContext = clCreateContext(cps, 1, &infoImpl.device_id, NULL, NULL, &status);
openCLVerifyCall(status);
// TODO add CL_QUEUE_PROFILING_ENABLE
#ifdef PRINT_KERNEL_RUN_TIME
cl_command_queue clCmdQueue = clCreateCommandQueue(clContext, infoImpl.device_id, CL_QUEUE_PROFILING_ENABLE, &status);
#else /*PRINT_KERNEL_RUN_TIME*/
cl_command_queue clCmdQueue = clCreateCommandQueue(clContext, infoImpl.device_id, 0, &status);
#endif /*PRINT_KERNEL_RUN_TIME*/
openCLVerifyCall(status);
ContextImpl* ctx = new ContextImpl(infoImpl.info, infoImpl.device_id);
......
......@@ -459,28 +459,28 @@ void openCLExecuteKernel(Context *ctx, const cv::ocl::ProgramEntry* source, Stri
openCLExecuteKernel_(ctx, source, kernelName, globalThreads, localThreads, args, channels, depth,
build_options);
#else
string data_type[] = { "uchar", "char", "ushort", "short", "int", "float", "double"};
cout << endl;
cout << "Function Name: " << kernelName;
String data_type[] = { "uchar", "char", "ushort", "short", "int", "float", "double"};
std::cout << std::endl;
std::cout << "Function Name: " << kernelName;
if(depth >= 0)
cout << " |data type: " << data_type[depth];
cout << " |channels: " << channels;
cout << " |Time Unit: " << "ms" << endl;
std::cout << " |data type: " << data_type[depth];
std::cout << " |channels: " << channels;
std::cout << " |Time Unit: " << "ms" << std::endl;
total_execute_time = 0;
total_kernel_time = 0;
cout << "-------------------------------------" << endl;
std::cout << "-------------------------------------" << std::endl;
cout << setiosflags(ios::left) << setw(15) << "execute time";
cout << setiosflags(ios::left) << setw(15) << "launch time";
cout << setiosflags(ios::left) << setw(15) << "kernel time" << endl;
std::cout << std::setiosflags(std::ios::left) << std::setw(15) << "execute time";
std::cout << std::setiosflags(std::ios::left) << std::setw(15) << "launch time";
std::cout << std::setiosflags(std::ios::left) << std::setw(15) << "kernel time" << std::endl;
int i = 0;
for(i = 0; i < RUN_TIMES; i++)
openCLExecuteKernel_(ctx, source, kernelName, globalThreads, localThreads, args, channels, depth,
build_options);
cout << "average kernel execute time: " << total_execute_time / RUN_TIMES << endl; // "ms" << endl;
cout << "average kernel total time: " << total_kernel_time / RUN_TIMES << endl; // "ms" << endl;
std::cout << "average kernel execute time: " << total_execute_time / RUN_TIMES << std::endl; // "ms" << std::endl;
std::cout << "average kernel total time: " << total_kernel_time / RUN_TIMES << std::endl; // "ms" << std::endl;
#endif
}
......
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