Files
openvino/tools/legacy/benchmark_app/progress_bar.hpp
Ilya Churaev 8a9c19e3eb Warning as error for Windows (#13291)
* parent 6e7016ccda
author Ilya Churaev <ilya.churaev@intel.com> 1664281499 +0400
committer Ilya Churaev <ilya.churaev@intel.com> 1664510018 +0400

Fixed warnings on local machine

* Added CMAKE_COMPILE_WARNING_AS_ERROR usage

* Fixed style

* Fixed merge conflicts

* Fixed typo

* Fixed myriad build for macOS

* Fixed warning

* Fixed tests

* Disabled incorrect test

* Try to fix linux tests

* Revert "Try to fix linux tests"

This reverts commit 29224c93ff.

* Fixed tests

* Revert logic with incorrect cast

* Fixed log softmax

* Disable warning as error for cuda

* Try to fix inference_engine_s

* Fixed cmake

* Revert "Fixed cmake"

This reverts commit 87e9e4e674.

* Revert "Try to fix inference_engine_s"

This reverts commit a1adca8b05.

* WA for static symbols in inference_engine_s test library

* Fixed code style

* Fixed static definition for master

* Revert "Fixed static definition for master"

This reverts commit 20d00d215a.

* Revert "Fixed code style"

This reverts commit 0eb2362543.

* Revert "WA for static symbols in inference_engine_s test library"

This reverts commit 75ef86a79d.

* Fixed linker issue for Windows

* Disable WaE by default

* Disable warning as error in the developer package

* Try to fix dev package

* Try to fix Windows Jenkins

* Revert old behavior for tread_warn_as_err variable
2022-10-06 13:44:21 +04:00

52 lines
1.3 KiB
C++

// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <memory>
#include "console_progress.hpp"
/// @brief Responsible for progress bar handling within the benchmark_app
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(static_cast<int>(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;
};