diff options
author | Declan-ARM <decmce01@arm.com> | 2024-03-12 16:40:25 +0000 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2024-03-13 10:07:56 +0000 |
commit | 7c75e336fbeeec052a1cb90c68d1caece332c176 (patch) | |
tree | 8fac689c1b4192522f5fa98bccbfab12b8e08afe /src/armnn/Profiling.cpp | |
parent | 93bbf00d968101fb9a9174ad011b655ca7100546 (diff) | |
download | armnn-7c75e336fbeeec052a1cb90c68d1caece332c176.tar.gz |
IVGCVSW-7853 Assert audit and removal
* src/armnn
* src/armnn/layers
Signed-off-by: Declan-ARM <decmce01@arm.com>
Change-Id: Ic78cbbb59e90fbb15f893205a358c45264243721
Diffstat (limited to 'src/armnn/Profiling.cpp')
-rw-r--r-- | src/armnn/Profiling.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/armnn/Profiling.cpp b/src/armnn/Profiling.cpp index db2962ecad..78afb05611 100644 --- a/src/armnn/Profiling.cpp +++ b/src/armnn/Profiling.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017,2024 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // #include "Profiling.hpp" @@ -43,7 +43,7 @@ constexpr bool g_WriteReportToStdOutOnProfilerDestruction = false; Measurement FindMeasurement(const std::string& name, const Event* event) { - ARMNN_ASSERT(event != nullptr); + ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(event, "event should not be null."); // Search though the measurements. for (const auto& measurement : event->GetMeasurements()) @@ -61,7 +61,7 @@ Measurement FindMeasurement(const std::string& name, const Event* event) std::vector<Measurement> FindKernelMeasurements(const Event* event) { - ARMNN_ASSERT(event != nullptr); + ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(event, "event should not be null."); std::vector<Measurement> measurements; @@ -230,13 +230,24 @@ void ProfilerImpl::EndEvent(Event* event) { event->Stop(); - ARMNN_ASSERT(!m_Parents.empty()); - ARMNN_ASSERT(event == m_Parents.top()); + if (!!m_Parents.empty()) + { + throw armnn::Exception("m_Parents must not be empty."); + } + + if (event != m_Parents.top()) + { + throw armnn::Exception("event must match the top of m_Parents."); + } + m_Parents.pop(); Event* parent = m_Parents.empty() ? nullptr : m_Parents.top(); - IgnoreUnused(parent); - ARMNN_ASSERT(event->GetParentEvent() == parent); + + if (event->GetParentEvent() != parent) + { + throw armnn::Exception("parent events must match."); + } #if ARMNN_STREAMLINE_ENABLED ANNOTATE_CHANNEL_END(uint32_t(m_Parents.size())); @@ -305,7 +316,7 @@ void ExtractJsonObjects(unsigned int inferenceIndex, JsonChildObject& parentObject, std::map<const Event*, std::vector<const Event*>> descendantsMap) { - ARMNN_ASSERT(parentEvent); + ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(parentEvent, "parentEvent must not be null."); // If profiling GUID is entered, process it if (parentEvent->GetProfilingGuid().has_value()) @@ -339,7 +350,10 @@ void ExtractJsonObjects(unsigned int inferenceIndex, measurementObject.SetUnit(instrumentMeasurements[measurementIndex].m_Unit); measurementObject.SetType(JsonObjectType::Measurement); - ARMNN_ASSERT(parentObject.NumChildren() == childIdx); + if (parentObject.NumChildren() != childIdx) + { + throw armnn::Exception("parentObject must have the same number of children as childIdx."); + } parentObject.AddChild(measurementObject); } else |