diff options
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; |