diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-10-22 11:07:45 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-10-25 16:07:45 +0000 |
commit | 830101c2debac8b3f22c048fad603f34b76bdca1 (patch) | |
tree | f398bcbd687503a79fcced3e34f0411f5864f94a /src/profiling/TimelineUtilityMethods.cpp | |
parent | 48623a0f6f4681ce0d9525b1587b7f96bfd58519 (diff) | |
download | armnn-830101c2debac8b3f22c048fad603f34b76bdca1.tar.gz |
IVGCVSW-4022 Create a DeclareLabel utility function
* Created new TimelineUtilityMethods class
* Created the DeclareLabel utility methods inside the new class
* Added unit tests
Change-Id: Ife0f7853a556d48206b76baeb3934344a990bee9
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/profiling/TimelineUtilityMethods.cpp')
-rw-r--r-- | src/profiling/TimelineUtilityMethods.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp new file mode 100644 index 0000000000..5ae0cf6ee1 --- /dev/null +++ b/src/profiling/TimelineUtilityMethods.cpp @@ -0,0 +1,35 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "TimelineUtilityMethods.hpp" +#include "ProfilingService.hpp" + +namespace armnn +{ + +namespace profiling +{ + +ProfilingStaticGuid TimelineUtilityMethods::DeclareLabel(const std::string& labelName) +{ + // Check that the label name is valid + if (labelName.empty()) + { + // The label name is invalid + throw InvalidArgumentException("Invalid label name, the label name cannot be empty"); + } + + // Generate a static GUID for the given label name + ProfilingStaticGuid labelGuid = ProfilingService::Instance().GenerateStaticId(labelName); + + // Send the new label to the external profiling service, this call throws in case of error + m_SendTimelinePacket.SendTimelineLabelBinaryPacket(labelGuid, labelName); + + return labelGuid; +} + +} // namespace profiling + +} // namespace armnn |