From 86ef04d4d6f312820e570bd5077bf898709a35b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vitaliy=20Cherepanov/AI=20Tools=20Lab=20/SRR/Engineer/?= =?utf8?q?=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 4 Jul 2018 02:54:18 +0300 Subject: [PATCH] tflite_benchmark: get env refactor (#1801) * tflite_benchmark: get env refactor using nnfw::util::get_env_int instead of custom get_env call Signed-off-by: Vitaliy Cherepanov * add const spec Signed-off-by: Vitaliy Cherepanov * fix compare signed/unsigned issue --- tools/tflite_benchmark/src/tflite_benchmark.cc | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/tools/tflite_benchmark/src/tflite_benchmark.cc b/tools/tflite_benchmark/src/tflite_benchmark.cc index f20cef3..cfe244e 100644 --- a/tools/tflite_benchmark/src/tflite_benchmark.cc +++ b/tools/tflite_benchmark/src/tflite_benchmark.cc @@ -38,26 +38,6 @@ using namespace tflite; using namespace tflite::ops::builtin; -class Count -{ -public: - Count() : _value(1) - { - auto env = std::getenv("COUNT"); - - if (env) - { - _value = atoi(env); - } - } - -public: - uint32_t value(void) const { return _value; } - -private: - uint32_t _value; -}; - void help(std::ostream &out, const int argc, char **argv) { std::string cmd = argv[0]; @@ -223,13 +203,13 @@ int main(const int argc, char **argv) // // Measure // - const Count count; + const auto cnt = nnfw::util::get_env_int("COUNT", 1); using namespace boost::accumulators; accumulator_set> acc; - for (uint32_t n = 0; n < count.value(); ++n) + for (int n = 0; n < cnt; ++n) { std::chrono::milliseconds elapsed(0); -- 2.7.4