mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 13:47:32 +08:00
Merge pull request #1882 from philippefoubert:branch_ocl_instrumentation
This commit is contained in:
commit
aed69cc458
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user