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 /arm_compute/core/utils/logging | |
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 'arm_compute/core/utils/logging')
-rw-r--r-- | arm_compute/core/utils/logging/FilePrinter.h | 3 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/Helpers.h | 3 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/IPrinter.h | 3 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/LogMsgDecorators.h | 5 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/Logger.h | 6 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/LoggerRegistry.h | 13 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/Macros.h | 16 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/Types.h | 6 |
8 files changed, 27 insertions, 28 deletions
diff --git a/arm_compute/core/utils/logging/FilePrinter.h b/arm_compute/core/utils/logging/FilePrinter.h index 0e5b84f084..a865aadddb 100644 --- a/arm_compute/core/utils/logging/FilePrinter.h +++ b/arm_compute/core/utils/logging/FilePrinter.h @@ -24,9 +24,8 @@ #ifndef ARM_COMPUTE_LOGGING_FILE_PRINTER_H #define ARM_COMPUTE_LOGGING_FILE_PRINTER_H -#include "arm_compute/core/utils/logging/IPrinter.h" - #include "arm_compute/core/utils/io/FileHandler.h" +#include "arm_compute/core/utils/logging/IPrinter.h" namespace arm_compute { diff --git a/arm_compute/core/utils/logging/Helpers.h b/arm_compute/core/utils/logging/Helpers.h index 5f8b948592..c3c2f0f0b8 100644 --- a/arm_compute/core/utils/logging/Helpers.h +++ b/arm_compute/core/utils/logging/Helpers.h @@ -25,6 +25,7 @@ #define ARM_COMPUTE_LOGGING_HELPERS_H #include "arm_compute/core/utils/logging/Types.h" + #include "support/ToolchainSupport.h" #include <cstddef> @@ -45,7 +46,7 @@ namespace logging * @return The formatted string */ template <typename... Ts> -inline std::string string_with_format(const std::string &fmt, Ts &&... args) +inline std::string string_with_format(const std::string &fmt, Ts &&...args) { size_t size = support::cpp11::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; auto char_str = std::make_unique<char[]>(size); diff --git a/arm_compute/core/utils/logging/IPrinter.h b/arm_compute/core/utils/logging/IPrinter.h index 42dca58ea1..7fde4d9302 100644 --- a/arm_compute/core/utils/logging/IPrinter.h +++ b/arm_compute/core/utils/logging/IPrinter.h @@ -35,8 +35,7 @@ class Printer { public: /** Default Constructor */ - Printer() noexcept - : _mtx() + Printer() noexcept : _mtx() { } /** Prevent instances of this class from being copied */ diff --git a/arm_compute/core/utils/logging/LogMsgDecorators.h b/arm_compute/core/utils/logging/LogMsgDecorators.h index 9c9e62740f..66a8180e21 100644 --- a/arm_compute/core/utils/logging/LogMsgDecorators.h +++ b/arm_compute/core/utils/logging/LogMsgDecorators.h @@ -63,8 +63,7 @@ public: * * @param str Sting to append */ - StringDecorator(const std::string &str) - : _str(str) + StringDecorator(const std::string &str) : _str(str) { _str = angle_wrap_value(str); } @@ -103,7 +102,7 @@ private: auto time = std::chrono::system_clock::to_time_t(now); // TODO: use put_time for gcc > 4.9 - char buf[100] = { 0 }; + char buf[100] = {0}; std::strftime(buf, sizeof(buf), "%d-%m-%Y %I:%M:%S", std::localtime(&time)); return buf; } diff --git a/arm_compute/core/utils/logging/Logger.h b/arm_compute/core/utils/logging/Logger.h index 4fc9bb7dbf..608db39138 100644 --- a/arm_compute/core/utils/logging/Logger.h +++ b/arm_compute/core/utils/logging/Logger.h @@ -88,7 +88,7 @@ public: * @param[in] args Message arguments */ template <typename... Ts> - void log(LogLevel log_level, const std::string &fmt, Ts &&... args); + void log(LogLevel log_level, const std::string &fmt, Ts &&...args); /** Sets log level of the logger * * @warning Not thread-safe @@ -159,11 +159,11 @@ private: }; template <typename... Ts> -inline void Logger::log(LogLevel log_level, const std::string &fmt, Ts &&... args) +inline void Logger::log(LogLevel log_level, const std::string &fmt, Ts &&...args) { // Return if message shouldn't be logged // i.e. if log level does not match the logger's - if(!is_loggable(log_level)) + if (!is_loggable(log_level)) { return; } diff --git a/arm_compute/core/utils/logging/LoggerRegistry.h b/arm_compute/core/utils/logging/LoggerRegistry.h index 7c9931a260..4e52a10935 100644 --- a/arm_compute/core/utils/logging/LoggerRegistry.h +++ b/arm_compute/core/utils/logging/LoggerRegistry.h @@ -27,6 +27,7 @@ #include "arm_compute/core/utils/logging/Logger.h" #include "arm_compute/core/utils/logging/Printers.h" #include "arm_compute/core/utils/logging/Types.h" + #include "support/Mutex.h" #include <memory> @@ -54,8 +55,9 @@ public: * @param[in] log_level Logger's log level. Defaults to INFO * @param[in] printers Printers to attach to the system loggers. Defaults with a @ref StdPrinter. */ - void create_logger(const std::string &name, LogLevel log_level = LogLevel::INFO, - const std::vector<std::shared_ptr<Printer>> &printers = { std::make_shared<StdPrinter>() }); + void create_logger(const std::string &name, + LogLevel log_level = LogLevel::INFO, + const std::vector<std::shared_ptr<Printer>> &printers = {std::make_shared<StdPrinter>()}); /** Remove a logger * * @param name Logger's name @@ -74,16 +76,17 @@ public: * @param[in] printers (Optional) Printers to attach to the system loggers. Defaults with a @ref StdPrinter. */ void create_reserved_loggers(LogLevel log_level = LogLevel::INFO, - const std::vector<std::shared_ptr<Printer>> &printers = { std::make_shared<StdPrinter>() }); + const std::vector<std::shared_ptr<Printer>> &printers = { + std::make_shared<StdPrinter>()}); private: /** Default constructor */ LoggerRegistry(); private: - arm_compute::Mutex _mtx; + arm_compute::Mutex _mtx; std::unordered_map<std::string, std::shared_ptr<Logger>> _loggers; - static std::set<std::string> _reserved_loggers; + static std::set<std::string> _reserved_loggers; }; } // namespace logging } // namespace arm_compute diff --git a/arm_compute/core/utils/logging/Macros.h b/arm_compute/core/utils/logging/Macros.h index 0ab17c4464..4d5aa5fe2c 100644 --- a/arm_compute/core/utils/logging/Macros.h +++ b/arm_compute/core/utils/logging/Macros.h @@ -48,48 +48,48 @@ inline std::string signature_name(const std::string &pretty_func) do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ __logger->log(log_level, msg); \ } \ - } while(false) + } while (false) #define ARM_COMPUTE_LOG_MSG_WITH_FUNCNAME(logger_name, log_level, msg) \ do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ std::ostringstream s; \ s << ARM_COMPUTE_SIGNATURE_NAME << " : " << msg; \ __logger->log(log_level, s.str()); \ } \ - } while(false) + } while (false) #define ARM_COMPUTE_LOG_MSG_WITH_FORMAT(logger_name, log_level, fmt, ...) \ do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ size_t size = ::snprintf(nullptr, 0, fmt, __VA_ARGS__) + 1; \ auto char_str = std::make_unique<char[]>(size); \ ::snprintf(char_str.get(), size, fmt, __VA_ARGS__); \ __logger->log(log_level, std::string(char_str.get(), char_str.get() + size - 1)); \ } \ - } while(false) + } while (false) #define ARM_COMPUTE_LOG_STREAM(logger_name, log_level, stream) \ do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ std::ostringstream s; \ s << stream; \ __logger->log(log_level, s.str()); \ } \ - } while(false) + } while (false) #else /* ARM_COMPUTE_LOGGING_ENABLED */ diff --git a/arm_compute/core/utils/logging/Types.h b/arm_compute/core/utils/logging/Types.h index f0ddae6c84..64c567b984 100644 --- a/arm_compute/core/utils/logging/Types.h +++ b/arm_compute/core/utils/logging/Types.h @@ -44,8 +44,7 @@ enum class LogLevel struct LogMsg { /** Default constructor */ - LogMsg() - : raw_(), log_level_(LogLevel::OFF) + LogMsg() : raw_(), log_level_(LogLevel::OFF) { } /** Construct a log message @@ -53,8 +52,7 @@ struct LogMsg * @param[in] msg Message to log. * @param[in] log_level Logging level. Default: OFF */ - LogMsg(std::string msg, LogLevel log_level = LogLevel::OFF) - : raw_(msg), log_level_(log_level) + LogMsg(std::string msg, LogLevel log_level = LogLevel::OFF) : raw_(msg), log_level_(log_level) { } |