[demo] add printing timestamp
authorTae-Young Chung <ty83.chung@samsung.com>
Mon, 28 Oct 2024 07:06:58 +0000 (16:06 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Mon, 28 Oct 2024 07:06:58 +0000 (16:06 +0900)
Change-Id: I6558583b5f4592041b14d8d8fedd607952d6f147
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
services/focus_finder/src/GazeEstimator.cpp

index 5c99701a223ca4f24ce3ddb7fa6e5c323ed79a9b..857f8d4311952c6145d69089daf5d10ceb9f62c9 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
 */
 
+#include <chrono>
+#include <iostream>
 #include "SingleoInferenceTypes.h"
 #include "GazeEstimator.h"
 #include "FaceDetector.h"
@@ -52,7 +54,9 @@ GazeEstimator::~GazeEstimator()
 const GazeResultType& GazeEstimator::run(BaseDataType &input)
 {
        FaceResult result;
+       chrono::steady_clock::time_point start = chrono::steady_clock::now();
        _face_tasker->handle(input, result);
+       cout << "Face detection time: " << chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - start).count() << "ms\n";
        SINGLEO_LOGI("FaceResult: faces %zu", result._rects.size());
 
        _head_axes.clear();
@@ -74,7 +78,9 @@ const GazeResultType& GazeEstimator::run(BaseDataType &input)
                normalized_image.byte_per_pixel = cv_warped_image.channels();
                normalized_image.ptr = cv_warped_image.data;
 
+               start = chrono::steady_clock::now();
                _gaze_estimator->invoke(normalized_image);
+               cout << "Gaze estimation time: " << chrono::duration_cast<chrono::milliseconds>(chrono::steady_clock::now() - start).count() << "ms\n";
                auto normalized_gaze_angle = dynamic_cast<GazeResultType &>(_gaze_estimator->result());
 
                _result = _head_pose_estimator->denormalizeGazeAngle(normalized_gaze_angle);