diff options
author | David Monahan <david.monahan@arm.com> | 2020-02-26 10:24:03 +0000 |
---|---|---|
committer | David Monahan <david.monahan@arm.com> | 2020-03-03 07:26:24 +0000 |
commit | b015e5db20e29825caefa05d828fbeed73119b19 (patch) | |
tree | 7c5814635aeeabff69f1595de7ea663b3ef58ff6 /src | |
parent | 03fbeaf532f2575381edc2336f834973117f6e0f (diff) | |
download | armnn-b015e5db20e29825caefa05d828fbeed73119b19.tar.gz |
Modifying the IBackendProfilingContext interface to return a bool on
EnableProfiling and adding error checking to the Runtime
Invocation
Signed-off-by: David Monahan <david.monahan@arm.com>
Change-Id: I65b8bb16c6f1c7d668de31238ce0408a48974997
Diffstat (limited to 'src')
-rw-r--r-- | src/armnn/Runtime.cpp | 12 | ||||
-rw-r--r-- | src/backends/backendsCommon/test/MockBackend.hpp | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index c1416f94d7..b1017c58ed 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -192,8 +192,16 @@ Runtime::Runtime(const CreationOptions& options) // Backends that don't support profiling will return a null profiling context. if (profilingContext) { - // Pass the context onto the profiling service. - armnn::profiling::ProfilingService::Instance().AddBackendProfilingContext(id, profilingContext); + // Enable profiling on the backend and assert that it returns true + if(profilingContext->EnableProfiling(true)) + { + // Pass the context onto the profiling service. + armnn::profiling::ProfilingService::Instance().AddBackendProfilingContext(id, profilingContext); + } + else + { + throw BackendProfilingException("Unable to enable profiling on Backend Id: " + id.Get()); + } } } catch (const BackendUnavailableException&) diff --git a/src/backends/backendsCommon/test/MockBackend.hpp b/src/backends/backendsCommon/test/MockBackend.hpp index 3227ce52fc..6e415b9b52 100644 --- a/src/backends/backendsCommon/test/MockBackend.hpp +++ b/src/backends/backendsCommon/test/MockBackend.hpp @@ -88,8 +88,10 @@ public: return { profiling::Timestamp{ timestamp, counterValues } }; } - void EnableProfiling(bool) - {} + bool EnableProfiling(bool) + { + return true; + } private: IBackendInternal::IBackendProfilingPtr m_BackendProfiling; |