summaryrefslogtreecommitdiff
path: root/python/openvino/runtime/dla_benchmark/progress_bar.hpp
diff options
context:
space:
mode:
authorEric Dao <eric@erickhangdao.com>2025-03-10 17:54:31 -0400
committerEric Dao <eric@erickhangdao.com>2025-03-10 17:54:31 -0400
commitab224e2e6ba65f5a369ec392f99cd8845ad06c98 (patch)
treea1e757e9341863ed52b8ad4c5a1c45933aab9da4 /python/openvino/runtime/dla_benchmark/progress_bar.hpp
parent40da1752f2c8639186b72f6838aa415e854d0b1d (diff)
downloadthesis-master.tar.gz
thesis-master.tar.bz2
thesis-master.zip
completed thesisHEADmaster
Diffstat (limited to 'python/openvino/runtime/dla_benchmark/progress_bar.hpp')
-rw-r--r--python/openvino/runtime/dla_benchmark/progress_bar.hpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/python/openvino/runtime/dla_benchmark/progress_bar.hpp b/python/openvino/runtime/dla_benchmark/progress_bar.hpp
new file mode 100644
index 0000000..cb4459a
--- /dev/null
+++ b/python/openvino/runtime/dla_benchmark/progress_bar.hpp
@@ -0,0 +1,52 @@
+// Copyright (C) 2018-2023 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <memory>
+
+#include <samples/console_progress.hpp>
+
+/// @brief Responsible for progress bar handling within the dla_benchmark
+class ProgressBar {
+ public:
+ explicit ProgressBar(size_t totalNum, bool streamOutput = false, bool progressEnabled = false) {
+ _bar.reset(new ConsoleProgress(totalNum, streamOutput));
+ _streamOutput = streamOutput;
+ _isFinished = true;
+ _progressEnabled = progressEnabled;
+ }
+
+ void addProgress(size_t num) {
+ _isFinished = false;
+ if (_progressEnabled) {
+ _bar->addProgress(num);
+ }
+ }
+
+ void finish(size_t num = 0) {
+ if (num > 0) {
+ addProgress(num);
+ }
+ _isFinished = true;
+ _bar->finish();
+ if (_progressEnabled) {
+ std::cout << std::endl;
+ }
+ }
+
+ void newBar(size_t totalNum) {
+ if (_isFinished) {
+ _bar.reset(new ConsoleProgress(totalNum, _streamOutput));
+ } else {
+ throw std::logic_error("Cannot create a new bar. Current bar is still in progress");
+ }
+ }
+
+ private:
+ std::unique_ptr<ConsoleProgress> _bar;
+ bool _streamOutput;
+ bool _isFinished;
+ bool _progressEnabled;
+};