From b77bea2f1de53add7a4c1ce4ae609b909ad65540 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sun, 12 Jul 2015 09:11:54 -0400 Subject: [PATCH] Added library initialization time. Resolves issue #161 --- src/openalpr/alpr_impl.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index 0d334b6..fc8ca37 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -29,6 +29,10 @@ namespace alpr { AlprImpl::AlprImpl(const std::string country, const std::string configFile, const std::string runtimeDir) { + + timespec startTime; + getTimeMonotonic(&startTime); + config = new Config(country, configFile, runtimeDir); plateDetector = ALPR_NULL_PTR; @@ -51,7 +55,12 @@ namespace alpr setDefaultRegion(""); prewarp = new PreWarp(config); - + + timespec endTime; + getTimeMonotonic(&endTime); + if (config->debugTiming) + cout << "OpenALPR Initialization Time: " << diffclock(startTime, endTime) << "ms." << endl; + } AlprImpl::~AlprImpl() { @@ -559,12 +568,22 @@ namespace alpr void AlprImpl::setDetectRegion(bool detectRegion) { + this->detectRegion = detectRegion; if (detectRegion && this->stateIdentifier == NULL) { + timespec startTime; + getTimeMonotonic(&startTime); + this->stateIdentifier = new StateIdentifier(this->config); + + timespec endTime; + getTimeMonotonic(&endTime); + if (config->debugTiming) + cout << "State Identification Initialization Time: " << diffclock(startTime, endTime) << "ms." << endl; } + } void AlprImpl::setTopN(int topn) {