diff options
author | Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-27 17:46:17 +0100 |
---|---|---|
committer | felixjohnny.thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-28 12:08:05 +0000 |
commit | afd38f0c617d6f89b2b4532c6c44f116617e2b6f (patch) | |
tree | 03bc7d5a762099989b16a656fa8d397b490ed70e /src/common/utils/Log.h | |
parent | bdcb4c148ee2fdeaaddf4cf1e57bbb0de02bb894 (diff) | |
download | ComputeLibrary-afd38f0c617d6f89b2b4532c6c44f116617e2b6f.tar.gz |
Apply clang-format on repository
Code is formatted as per a revised clang format configuration
file(not part of this delivery). Version 14.0.6 is used.
Exclusion List:
- files with .cl extension
- files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...)
And the following directories
- compute_kernel_writer/validation/
- tests/
- include/
- src/core/NEON/kernels/convolution/
- src/core/NEON/kernels/arm_gemm/
- src/core/NEON/kernels/arm_conv/
- data/
There will be a follow up for formatting of .cl files and the
files under tests/ and compute_kernel_writer/validation/.
Signed-off-by: Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com>
Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Diffstat (limited to 'src/common/utils/Log.h')
-rw-r--r-- | src/common/utils/Log.h | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/src/common/utils/Log.h b/src/common/utils/Log.h index bbfe1ce1b3..6ebfed366e 100644 --- a/src/common/utils/Log.h +++ b/src/common/utils/Log.h @@ -38,20 +38,22 @@ #include "arm_compute/core/Error.h" #include "arm_compute/core/utils/logging/Macros.h" + #include "utils/TypePrinter.h" /** Create a logger * * @note It will eventually create all default loggers in don't exist */ -#define ARM_COMPUTE_CREATE_ACL_LOGGER() \ - do \ - { \ - if(arm_compute::logging::LoggerRegistry::get().logger("ComputeLibrary") == nullptr) \ - { \ - arm_compute::logging::LoggerRegistry::get().create_logger("ComputeLibrary", arm_compute::logging::LogLevel::INFO); \ - } \ - } while(false) +#define ARM_COMPUTE_CREATE_ACL_LOGGER() \ + do \ + { \ + if (arm_compute::logging::LoggerRegistry::get().logger("ComputeLibrary") == nullptr) \ + { \ + arm_compute::logging::LoggerRegistry::get().create_logger("ComputeLibrary", \ + arm_compute::logging::LogLevel::INFO); \ + } \ + } while (false) /** Log a message to the logger * @@ -63,7 +65,7 @@ { \ ARM_COMPUTE_CREATE_ACL_LOGGER(); \ ARM_COMPUTE_LOG_MSG("ComputeLibrary", log_level, msg); \ - } while(false) + } while (false) /** Log a message with format to the logger * @@ -76,7 +78,7 @@ { \ ARM_COMPUTE_CREATE_ACL_LOGGER(); \ ARM_COMPUTE_LOG_MSG_WITH_FORMAT("ComputeLibrary", log_level, fmt, __VA_ARGS__); \ - } while(false) + } while (false) /** Log an error message to the logger * @@ -87,7 +89,7 @@ { \ ARM_COMPUTE_CREATE_ACL_LOGGER(); \ ARM_COMPUTE_LOG_MSG("ComputeLibrary", arm_compute::logging::LogLevel::ERROR, msg); \ - } while(false) + } while (false) /** Log an error message to the logger with function name before the message * @@ -98,7 +100,7 @@ { \ ARM_COMPUTE_CREATE_ACL_LOGGER(); \ ARM_COMPUTE_LOG_MSG_WITH_FUNCNAME("ComputeLibrary", arm_compute::logging::LogLevel::ERROR, msg); \ - } while(false) + } while (false) /** Log an information message to the logger with function name before the message * @@ -109,7 +111,7 @@ { \ ARM_COMPUTE_CREATE_ACL_LOGGER(); \ ARM_COMPUTE_LOG_MSG_WITH_FUNCNAME("ComputeLibrary", arm_compute::logging::LogLevel::INFO, msg); \ - } while(false) + } while (false) /** Function template specialization for the out of bound element at index = tuple_size * @@ -131,12 +133,13 @@ logParamsImpl(std::vector<std::string> &data_registry, const std::tuple<Tp...> & * @param[in] in_params_tuple Constant reference to a tuple of different input data types */ template <std::size_t Index, typename... Tp> -inline typename std::enable_if < Index<sizeof...(Tp), void>::type -logParamsImpl(std::vector<std::string> &data_registry, const std::tuple<Tp...> &in_params_tuple) + inline typename std::enable_if < + Index<sizeof...(Tp), void>::type logParamsImpl(std::vector<std::string> &data_registry, + const std::tuple<Tp...> &in_params_tuple) { data_registry.push_back(arm_compute::to_string(std::get<Index>(in_params_tuple))); // Unfold the next tuple element - logParamsImpl < Index + 1, Tp... > (data_registry, in_params_tuple); + logParamsImpl<Index + 1, Tp...>(data_registry, in_params_tuple); } /** Function Template with variable number of inputs to collect all the passed parameters from @@ -149,10 +152,10 @@ logParamsImpl(std::vector<std::string> &data_registry, const std::tuple<Tp...> & * @return Vector of the parameters' data in a string format */ template <typename... Ts> -const std::vector<std::string> logParams(Ts &&... ins) +const std::vector<std::string> logParams(Ts &&...ins) { std::vector<std::string> data_registry{}; - std::tuple<Ts...> in_params_tuple{ ins... }; + std::tuple<Ts...> in_params_tuple{ins...}; // Start logging the tuple elements, starting from 0 to tuple_size-1 logParamsImpl<0>(data_registry, in_params_tuple); @@ -178,11 +181,11 @@ inline const std::vector<std::string> getParamsNames(const std::string &in_param // Usually the input parameters string would be name of parameters separated // by ',' e.g. "src0, src1, policy" - while(std::getline(ss, temp, ',')) + while (std::getline(ss, temp, ',')) { names.push_back(temp); } - for(auto &name : names) + for (auto &name : names) { // Totally get rid of white space characters name.erase(std::remove(name.begin(), name.end(), ' '), name.end()); @@ -205,7 +208,7 @@ inline const std::string constructDataLog(const std::vector<std::string> ¶ms { std::string dataLog = "\n "; ARM_COMPUTE_ERROR_ON(params_names.size() != data_registry.size()); - for(uint8_t i = 0; i < params_names.size(); ++i) + for (uint8_t i = 0; i < params_names.size(); ++i) { dataLog += params_names[i] + ": " + data_registry.at(i) + "\n "; } @@ -220,11 +223,11 @@ inline const std::string constructDataLog(const std::vector<std::string> ¶ms * * @param[in] ... Input parameters */ -#define ARM_COMPUTE_LOG_PARAMS(...) \ - do \ - { \ - ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL(constructDataLog(getParamsNames(#__VA_ARGS__), \ - logParams(__VA_ARGS__))); \ - } while(false) +#define ARM_COMPUTE_LOG_PARAMS(...) \ + do \ + { \ + ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL( \ + constructDataLog(getParamsNames(#__VA_ARGS__), logParams(__VA_ARGS__))); \ + } while (false) #endif /* ARM_COMPUTE_LOGGING_ENABLED */ #endif /* SRC_COMMON_LOG_H */ |