mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
opencv_version: dump threads information
This commit is contained in:
parent
3a99ebb446
commit
3d36f9044d
@ -14,6 +14,11 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// defined in core/private.hpp
|
||||||
|
namespace cv {
|
||||||
|
CV_EXPORTS const char* currentParallelFramework();
|
||||||
|
}
|
||||||
|
|
||||||
static void dumpHWFeatures(bool showAll = false)
|
static void dumpHWFeatures(bool showAll = false)
|
||||||
{
|
{
|
||||||
std::cout << "OpenCV's HW features list:" << std::endl;
|
std::cout << "OpenCV's HW features list:" << std::endl;
|
||||||
@ -34,6 +39,16 @@ static void dumpHWFeatures(bool showAll = false)
|
|||||||
std::cout << "Total available: " << count << std::endl;
|
std::cout << "Total available: " << count << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dumpParallelFramework()
|
||||||
|
{
|
||||||
|
const char* parallelFramework = cv::currentParallelFramework();
|
||||||
|
if (parallelFramework)
|
||||||
|
{
|
||||||
|
int threads = cv::getNumThreads();
|
||||||
|
std::cout << "Parallel framework: " << parallelFramework << " (nthreads=" << threads << ")" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, const char** argv)
|
int main(int argc, const char** argv)
|
||||||
{
|
{
|
||||||
CV_TRACE_FUNCTION();
|
CV_TRACE_FUNCTION();
|
||||||
@ -47,6 +62,7 @@ int main(int argc, const char** argv)
|
|||||||
"{ verbose v | | show build configuration log }"
|
"{ verbose v | | show build configuration log }"
|
||||||
"{ opencl | | show information about OpenCL (available platforms/devices, default selected device) }"
|
"{ opencl | | show information about OpenCL (available platforms/devices, default selected device) }"
|
||||||
"{ hw | | show detected HW features (see cv::checkHardwareSupport() function). Use --hw=0 to show available features only }"
|
"{ hw | | show detected HW features (see cv::checkHardwareSupport() function). Use --hw=0 to show available features only }"
|
||||||
|
"{ threads | | show configured parallel framework and number of active threads }"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (parser.has("help"))
|
if (parser.has("help"))
|
||||||
@ -73,10 +89,17 @@ int main(int argc, const char** argv)
|
|||||||
{
|
{
|
||||||
dumpHWFeatures(parser.get<bool>("hw"));
|
dumpHWFeatures(parser.get<bool>("hw"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parser.has("threads"))
|
||||||
|
{
|
||||||
|
dumpParallelFramework();
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
std::cout << cv::getBuildInformation().c_str() << std::endl;
|
std::cout << cv::getBuildInformation().c_str() << std::endl;
|
||||||
cv::dumpOpenCLInformation();
|
cv::dumpOpenCLInformation();
|
||||||
dumpHWFeatures();
|
dumpHWFeatures();
|
||||||
|
dumpParallelFramework();
|
||||||
MessageBoxA(NULL, "Check console window output", "OpenCV(" CV_VERSION ")", MB_ICONINFORMATION | MB_OK);
|
MessageBoxA(NULL, "Check console window output", "OpenCV(" CV_VERSION ")", MB_ICONINFORMATION | MB_OK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user