aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2022-01-26 09:57:05 +0000
committerSadik Armagan <sadik.armagan@arm.com>2022-01-27 10:47:00 +0000
commit4a0844db1ba4889153071c4023071f23860de817 (patch)
tree59329290f83517931f0af5d82039bcb996b8b463 /src
parent9ef361469ef64616c1fdb92d57258ac63a26804a (diff)
downloadarmnn-4a0844db1ba4889153071c4023071f23860de817.tar.gz
IVGCVSW-6739 'Issues on Logging API'
* Enabled using same instance of SimpleLogger * Removed some trailing new lines on some log messages Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I4b917c0ca5011afc9b39dad50715290ba15a1246
Diffstat (limited to 'src')
-rw-r--r--src/armnn/Logging.cpp50
-rw-r--r--src/armnn/Runtime.cpp28
2 files changed, 63 insertions, 15 deletions
diff --git a/src/armnn/Logging.cpp b/src/armnn/Logging.cpp
index 0cdcdc58ea..73879e644d 100644
--- a/src/armnn/Logging.cpp
+++ b/src/armnn/Logging.cpp
@@ -21,6 +21,55 @@
namespace armnn
{
+template<LogSeverity Level>
+SimpleLogger<Level>& SimpleLogger<Level>::Get()
+{
+ static SimpleLogger<Level> logger;
+ return logger;
+}
+
+template<>
+SimpleLogger<LogSeverity::Debug>& SimpleLogger<LogSeverity::Debug>::Get()
+{
+ static SimpleLogger<LogSeverity::Debug> logger;
+ return logger;
+}
+
+template<>
+SimpleLogger<LogSeverity::Trace>& SimpleLogger<LogSeverity::Trace>::Get()
+{
+ static SimpleLogger<LogSeverity::Trace> logger;
+ return logger;
+}
+
+template<>
+SimpleLogger<LogSeverity::Info>& SimpleLogger<LogSeverity::Info>::Get()
+{
+ static SimpleLogger<LogSeverity::Info> logger;
+ return logger;
+}
+
+template<>
+SimpleLogger<LogSeverity::Warning>& SimpleLogger<LogSeverity::Warning>::Get()
+{
+ static SimpleLogger<LogSeverity::Warning> logger;
+ return logger;
+}
+
+template<>
+SimpleLogger<LogSeverity::Error>& SimpleLogger<LogSeverity::Error>::Get()
+{
+ static SimpleLogger<LogSeverity::Error> logger;
+ return logger;
+}
+
+template<>
+SimpleLogger<LogSeverity::Fatal>& SimpleLogger<LogSeverity::Fatal>::Get()
+{
+ static SimpleLogger<LogSeverity::Fatal> logger;
+ return logger;
+}
+
void SetLogFilter(LogSeverity level)
{
SimpleLogger<LogSeverity::Trace>::Get().Enable(false);
@@ -149,5 +198,4 @@ void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
SetLoggingSinks<LogSeverity::Fatal>(standardOut, debugOut, coloured);
}
-
} //namespace armnn
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp
index 1ccfb4687a..2752e7209c 100644
--- a/src/armnn/Runtime.cpp
+++ b/src/armnn/Runtime.cpp
@@ -293,7 +293,7 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
m_ProfilingService(*this)
{
const auto start_time = armnn::GetTimeNow();
- ARMNN_LOG(info) << "ArmNN v" << ARMNN_VERSION << "\n";
+ ARMNN_LOG(info) << "ArmNN v" << ARMNN_VERSION;
if ( options.m_ProfilingOptions.m_TimelineEnabled && !options.m_ProfilingOptions.m_EnableProfiling )
{
throw RuntimeException(
@@ -337,7 +337,7 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
// backend should not be registered
ARMNN_LOG(warning) << "Backend "
<< id
- << " is not registered as does not support protected content allocation \n";
+ << " is not registered as does not support protected content allocation.";
continue;
}
// The user is responsible to provide a custom memory allocator which allows to allocate
@@ -431,7 +431,7 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
if (!strategy)
{
ARMNN_LOG(warning) << "MemoryOptimizerStrategy: " << memoryOptimizerStrategyName
- << " was not found \n";
+ << " was not found.";
}
else
{
@@ -450,7 +450,7 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
ARMNN_LOG(warning) << "Backend "
<< id
<< " does not have multi-axis packing capability and cannot support"
- << "MemoryOptimizerStrategy: " << memoryOptimizerStrategyName << "\n";
+ << "MemoryOptimizerStrategy: " << memoryOptimizerStrategyName << ".";
}
}
}
@@ -497,7 +497,7 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
m_DeviceSpec.AddSupportedBackends(supportedBackends);
ARMNN_LOG(info) << "Initialization time: " << std::setprecision(2)
- << std::fixed << armnn::GetTimeDuration(start_time).count() << " ms\n";
+ << std::fixed << armnn::GetTimeDuration(start_time).count() << " ms.";
}
RuntimeImpl::~RuntimeImpl()
@@ -547,7 +547,7 @@ RuntimeImpl::~RuntimeImpl()
BackendRegistryInstance().SetProfilingService(armnn::EmptyOptional());
ARMNN_LOG(info) << "Shutdown time: " << std::setprecision(2)
- << std::fixed << armnn::GetTimeDuration(startTime).count() << " ms\n";
+ << std::fixed << armnn::GetTimeDuration(startTime).count() << " ms.";
}
LoadedNetwork* RuntimeImpl::GetLoadedNetworkPtr(NetworkId networkId) const
@@ -595,12 +595,12 @@ Status RuntimeImpl::EnqueueWorkload(NetworkId networkId,
if (!loadedNetwork)
{
- ARMNN_LOG(error) << "A Network with an id of " << networkId << " does not exist.\n";
+ ARMNN_LOG(error) << "A Network with an id of " << networkId << " does not exist.";
return Status::Failure;
}
if (loadedNetwork->IsAsyncEnabled())
{
- ARMNN_LOG(error) << "Network " << networkId << " is async enabled.\n";
+ ARMNN_LOG(error) << "Network " << networkId << " is async enabled.";
return Status::Failure;
}
ProfilerManager::GetInstance().RegisterProfiler(loadedNetwork->GetProfiler().get());
@@ -620,7 +620,7 @@ Status RuntimeImpl::EnqueueWorkload(NetworkId networkId,
auto status = loadedNetwork->EnqueueWorkload(inputTensors, outputTensors);
ARMNN_LOG(info) << "Execution time: " << std::setprecision(2)
- << std::fixed << armnn::GetTimeDuration(startTime).count() << " ms\n";
+ << std::fixed << armnn::GetTimeDuration(startTime).count() << " ms.";
return status;
}
@@ -638,12 +638,12 @@ Status RuntimeImpl::Execute(IWorkingMemHandle& iWorkingMemHandle,
if (!loadedNetwork)
{
- ARMNN_LOG(error) << "A Network with an id of " << networkId << " does not exist.\n";
+ ARMNN_LOG(error) << "A Network with an id of " << networkId << " does not exist.";
return Status::Failure;
}
if (!loadedNetwork->IsAsyncEnabled())
{
- ARMNN_LOG(error) << "Attempting execute " << networkId << " when it is not async enabled.\n";
+ ARMNN_LOG(error) << "Attempting execute " << networkId << " when it is not async enabled.";
return Status::Failure;
}
ProfilerManager::GetInstance().RegisterProfiler(loadedNetwork->GetProfiler().get());
@@ -657,7 +657,7 @@ Status RuntimeImpl::Execute(IWorkingMemHandle& iWorkingMemHandle,
preImportedOutputs);
ARMNN_LOG(info) << "Execution time: " << std::setprecision(2)
- << std::fixed << armnn::GetTimeDuration(startTime).count() << " ms\n";
+ << std::fixed << armnn::GetTimeDuration(startTime).count() << " ms.";
return status;
}
@@ -670,12 +670,12 @@ std::unique_ptr<IWorkingMemHandle> RuntimeImpl::CreateWorkingMemHandle(NetworkId
if (!loadedNetwork)
{
- ARMNN_LOG(error) << "A Network with an id of " << networkId << " does not exist.\n";
+ ARMNN_LOG(error) << "A Network with an id of " << networkId << " does not exist.";
return nullptr;
}
if (!loadedNetwork->IsAsyncEnabled())
{
- ARMNN_LOG(error) << "Network " << networkId << " is not async enabled.\n";
+ ARMNN_LOG(error) << "Network " << networkId << " is not async enabled.";
return nullptr;
}
ProfilerManager::GetInstance().RegisterProfiler(loadedNetwork->GetProfiler().get());