diff options
author | 박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com> | 2019-08-05 12:53:13 +0900 |
---|---|---|
committer | 오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com> | 2019-08-05 12:53:13 +0900 |
commit | 34c8911c90883b55be1fc63b08b0ad3fd1ca3446 (patch) | |
tree | 434c93ec3cb2ffac7f7c9ace929700f30549912d /tests/tools/tflite_benchmark | |
parent | 8e1f6625db3db06e862a7f17e871c7598ce69495 (diff) | |
download | nnfw-34c8911c90883b55be1fc63b08b0ad3fd1ca3446.tar.gz nnfw-34c8911c90883b55be1fc63b08b0ad3fd1ca3446.tar.bz2 nnfw-34c8911c90883b55be1fc63b08b0ad3fd1ca3446.zip |
[tflite_benchmark] Insert pause between iterations (#6189)
tflite_benchmark now allows users to insert pause between iterations via
"PAUSE" environment variable.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
Diffstat (limited to 'tests/tools/tflite_benchmark')
-rw-r--r-- | tests/tools/tflite_benchmark/src/tflite_benchmark.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/tools/tflite_benchmark/src/tflite_benchmark.cc b/tests/tools/tflite_benchmark/src/tflite_benchmark.cc index 27ef2cb77..54c97c435 100644 --- a/tests/tools/tflite_benchmark/src/tflite_benchmark.cc +++ b/tests/tools/tflite_benchmark/src/tflite_benchmark.cc @@ -30,7 +30,9 @@ #include <boost/accumulators/statistics/max.hpp> #include <boost/accumulators/statistics/mean.hpp> +#include <chrono> #include <iostream> +#include <thread> #include "misc/environment.h" #include "misc/benchmark.h" @@ -70,6 +72,7 @@ int main(const int argc, char **argv) const bool use_nnapi = nnfw::misc::get_env_bool("USE_NNAPI"); const auto thread_count = nnfw::misc::get_env_int("THREAD", -1); + const auto pause = nnfw::misc::get_env_int("PAUSE", 0); std::cout << "Num threads: " << thread_count << std::endl; if (use_nnapi) @@ -77,6 +80,12 @@ int main(const int argc, char **argv) std::cout << "Use NNAPI" << std::endl; } + assert(pause >= 0); + if (pause > 0) + { + std::cout << "Insert " << pause << "s pause between iterations" << std::endl; + } + StderrReporter error_reporter; auto model = FlatBufferModel::BuildFromFile(filename, &error_reporter); @@ -228,6 +237,12 @@ int main(const int argc, char **argv) acc(elapsed.count()); std::cout << "Iteration " << n << ": " << elapsed.count() << "ms" << std::endl; + + // Insert "pause" + if ((n != cnt - 1) && (pause > 0)) + { + std::this_thread::sleep_for(std::chrono::seconds(pause)); + } } std::cout << "--------" << std::endl; |