diff options
author | Anthony Barbier <anthony.barbier@arm.com> | 2018-01-05 10:59:12 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:42:33 +0000 |
commit | 6db0ff5b4bb49f834c7caa532a7feab228df10f9 (patch) | |
tree | 36c32ab3e94a86752d6b73c4a3503b191431d586 /utils/Utils.cpp | |
parent | fde97fb84943d0328c2c532d117e9b875149f27e (diff) | |
download | ComputeLibrary-6db0ff5b4bb49f834c7caa532a7feab228df10f9.tar.gz |
COMPMID-771 Allow examples to be profiled
Change-Id: I180281e796e1670b9ad391d82d66ecde0119ef78
Note: this is for internal use only which is why I think the hackiness of RunExample.cpp is acceptable.
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/115154
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'utils/Utils.cpp')
-rw-r--r-- | utils/Utils.cpp | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/utils/Utils.cpp b/utils/Utils.cpp index f6aff6f92d..c2f5449a28 100644 --- a/utils/Utils.cpp +++ b/utils/Utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017, 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -66,7 +66,8 @@ void discard_comments_and_spaces(std::ifstream &fs) } } // namespace -int run_example(int argc, const char **argv, example &func) +//FIXME: Delete once tests have been ported (COMPMID-782) +int run_example(int argc, char **argv, example &func) { std::cout << "\n" << argv[0] << "\n\n"; @@ -100,6 +101,44 @@ int run_example(int argc, const char **argv, example &func) return -1; } +#ifndef BENCHMARK_EXAMPLES +int run_example(int argc, char **argv, Example &example) +{ + std::cout << "\n" + << argv[0] << "\n\n"; + + try + { + example.do_setup(argc, argv); + example.do_run(); + example.do_teardown(); + + std::cout << "\nTest passed\n"; + return 0; + } +#ifdef ARM_COMPUTE_CL + catch(cl::Error &err) + { + std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; + std::cerr << std::endl + << "ERROR " << err.what() << "(" << err.err() << ")" << std::endl; + std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; + } +#endif /* ARM_COMPUTE_CL */ + catch(std::runtime_error &err) + { + std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; + std::cerr << std::endl + << "ERROR " << err.what() << " " << (errno ? strerror(errno) : "") << std::endl; + std::cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; + } + + std::cout << "\nTest FAILED\n"; + + return -1; +} +#endif /* BENCHMARK_EXAMPLES */ + void draw_detection_rectangle(ITensor *tensor, const DetectionWindow &rect, uint8_t r, uint8_t g, uint8_t b) { ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(tensor, Format::RGB888); |