ArmNN
 24.08
Utils.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <string>
8 #include <cmath>
9 
10 namespace armnn
11 {
12 
13 enum class LogSeverity
14 {
15  Trace,
16  Debug,
17  Info,
18  Warning,
19  Error,
20  Fatal
21 };
22 
23 /// Configures the logging behaviour of the ARMNN library.
24 /// printToStandardOutput: Set to true if log messages should be printed to the standard output.
25 /// printToDebugOutput: Set to true if log messages be printed to a platform-specific debug output
26 /// (where supported).
27 /// severity: All log messages that are at this severity level or higher will be printed, others will be ignored.
28 void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity);
29 
30 
31 #if defined(__clang__) &&((__clang_major__>=3)||(__clang_major__==3 && __clang_minor__ >= 5))
32 # define ARMNN_FALLTHROUGH [[clang::fallthrough]]
33 #elif defined(__GNUC__) && (__GNUC__ >= 7)
34 # define ARMNN_FALLTHROUGH __attribute__((fallthrough))
35 #else
36 # define ARMNN_FALLTHROUGH ((void)0)
37 #endif
38 
39 bool NeonDetected();
40 
41 const std::string GetVersion();
42 
43 inline float roundf(float value)
44 {
45  // Workaround Valgrind's mismatches: when running from Valgrind the call to std::round(4.5) == 4.0 instead of 5.0
46  return (value < 0.f) ? ::floorf(value - 0.5f) : ::floorf(value + 0.5f);
47 }
48 
49 } // namespace armnn
armnn::LogSeverity::Trace
@ Trace
armnn::ConfigureLogging
void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
Configures the logging behaviour of the ARMNN library.
Definition: Utils.cpp:20
armnn::GetVersion
const std::string GetVersion()
Definition: Utils.cpp:81
armnn::LogSeverity::Info
@ Info
armnn::LogSeverity::Error
@ Error
armnn::LogSeverity::Fatal
@ Fatal
armnn::roundf
float roundf(float value)
Definition: Utils.hpp:43
armnn::NeonDetected
bool NeonDetected()
Definition: Utils.cpp:39
armnn::LogSeverity::Warning
@ Warning
armnn::LogSeverity::Debug
@ Debug
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::LogSeverity
LogSeverity
Definition: Utils.hpp:13