tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp
tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp
+ tests/profiling/gatordmock/StubCommandHandler.hpp
)
include_directories(src/profiling tests/profiling tests/profiling/gatordmock src/timelineDecoder)
m_StateMachine.TransitionToState(ProfilingState::Active);
// Send the counter directory packet.
m_SendCounterPacket.SendCounterDirectoryPacket(m_CounterDirectory);
- m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
- TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses(m_SendTimelinePacket);
+
+ if (m_TimelineEnabled)
+ {
+ m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
+ TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses(m_SendTimelinePacket);
+ }
if(m_BackendProfilingContext.has_value())
{
void operator()(const Packet& packet) override;
+ void setTimelineEnabled(bool timelineEnabled)
+ {
+ m_TimelineEnabled = timelineEnabled;
+ }
+
private:
const ICounterDirectory& m_CounterDirectory;
ISendCounterPacket& m_SendCounterPacket;
ISendTimelinePacket& m_SendTimelinePacket;
ProfilingStateMachine& m_StateMachine;
Optional<BackendProfilingContexts> m_BackendProfilingContext;
+ bool m_TimelineEnabled = false;
};
} // namespace profiling
// Update the profiling options
m_Options = options;
m_TimelineReporting = options.m_TimelineEnabled;
+ m_ConnectionAcknowledgedCommandHandler.setTimelineEnabled(options.m_TimelineEnabled);
// Check if the profiling service needs to be reset
if (resetProfilingService)
void TimelineDecoder::print()
{
+ if (m_Model.m_Labels.empty() && m_Model.m_Entities.empty() && m_Model.m_EventClasses.empty() &&
+ m_Model.m_Events.empty() && m_Model.m_Relationships.empty())
+ {
+ std::cout << "No timeline packets received" << std::endl;
+ return;
+ }
+
printLabels();
printEntities();
printEventClasses();
"If this option is enabled, the output of every graph layer will be printed.")
("enable-external-profiling,a", po::bool_switch()->default_value(false),
"If enabled external profiling will be switched on")
+ ("timeline-profiling", po::bool_switch()->default_value(false),
+ "If enabled timeline profiling will be switched on, requires external profiling")
("outgoing-capture-file,j", po::value(&outgoingCaptureFile),
"If specified the outgoing external profiling packets will be captured in this binary file")
("incoming-capture-file,k", po::value(&incomingCaptureFile),
bool enableExternalProfiling = vm["enable-external-profiling"].as<bool>();
bool fileOnlyExternalProfiling = vm["file-only-external-profiling"].as<bool>();
bool parseUnsupported = vm["parse-unsupported"].as<bool>();
+ bool timelineEnabled = vm["timeline-profiling"].as<bool>();
if (enableBf16TurboMode && enableFp16TurboMode)
{
return EXIT_FAILURE;
}
+ // Create runtime
+ armnn::IRuntime::CreationOptions options;
+ options.m_EnableGpuProfiling = enableProfiling;
+ options.m_DynamicBackendsPath = dynamicBackendsPath;
+ options.m_ProfilingOptions.m_EnableProfiling = enableExternalProfiling;
+ options.m_ProfilingOptions.m_IncomingCaptureFile = incomingCaptureFile;
+ options.m_ProfilingOptions.m_OutgoingCaptureFile = outgoingCaptureFile;
+ options.m_ProfilingOptions.m_FileOnly = fileOnlyExternalProfiling;
+ options.m_ProfilingOptions.m_CapturePeriod = counterCapturePeriod;
+ options.m_ProfilingOptions.m_FileFormat = fileFormat;
+ options.m_ProfilingOptions.m_TimelineEnabled = timelineEnabled;
+
+ if (timelineEnabled && !enableExternalProfiling)
+ {
+ ARMNN_LOG(fatal) << "Timeline profiling requires external profiling to be turned on";
+ return EXIT_FAILURE;
+ }
// Check whether we have to load test cases from a file.
if (CheckOption(vm, "test-cases"))
ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" has no test cases";
return EXIT_FAILURE;
}
-
// Create runtime
- armnn::IRuntime::CreationOptions options;
- options.m_EnableGpuProfiling = enableProfiling;
- options.m_DynamicBackendsPath = dynamicBackendsPath;
- options.m_ProfilingOptions.m_EnableProfiling = enableExternalProfiling;
- options.m_ProfilingOptions.m_IncomingCaptureFile = incomingCaptureFile;
- options.m_ProfilingOptions.m_OutgoingCaptureFile = outgoingCaptureFile;
- options.m_ProfilingOptions.m_FileOnly = fileOnlyExternalProfiling;
- options.m_ProfilingOptions.m_CapturePeriod = counterCapturePeriod;
- options.m_ProfilingOptions.m_FileFormat = fileFormat;
std::shared_ptr<armnn::IRuntime> runtime(armnn::IRuntime::Create(options));
const std::string executableName("ExecuteNetwork");
return EXIT_FAILURE;
}
// Create runtime
- armnn::IRuntime::CreationOptions options;
- options.m_EnableGpuProfiling = enableProfiling;
- options.m_DynamicBackendsPath = dynamicBackendsPath;
- options.m_ProfilingOptions.m_EnableProfiling = enableExternalProfiling;
- options.m_ProfilingOptions.m_IncomingCaptureFile = incomingCaptureFile;
- options.m_ProfilingOptions.m_OutgoingCaptureFile = outgoingCaptureFile;
- options.m_ProfilingOptions.m_FileOnly = fileOnlyExternalProfiling;
- options.m_ProfilingOptions.m_CapturePeriod = counterCapturePeriod;
- options.m_ProfilingOptions.m_FileFormat = fileFormat;
std::shared_ptr<armnn::IRuntime> runtime(armnn::IRuntime::Create(options));
return RunTest(modelFormat, inputTensorShapes, computeDevices, dynamicBackendsPath, modelPath, inputNames,
#include "StreamMetadataCommandHandler.hpp"
#include "PacketVersionResolver.hpp"
+#include "StubCommandHandler.hpp"
namespace armnn
{
, m_PacketVersionResolver()
, m_HandlerRegistry()
, m_TimelineDecoder()
- , m_StreamMetadataCommandHandler(
- 0, 0, m_PacketVersionResolver.ResolvePacketVersion(0, 0).GetEncodedValue(), !echoPackets)
, m_CounterCaptureCommandHandler(
0, 4, m_PacketVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(), !echoPackets)
+ , m_StreamMetadataCommandHandler(
+ 0, 0, m_PacketVersionResolver.ResolvePacketVersion(0, 0).GetEncodedValue(), !echoPackets)
+ // This stub lets us ignore any counter capture packets we receive without throwing an error
+ , m_StubCommandHandler(3, 0, m_PacketVersionResolver.ResolvePacketVersion(0, 3).GetEncodedValue())
, m_DirectoryCaptureCommandHandler(
0, 2, m_PacketVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), !echoPackets)
, m_TimelineCaptureCommandHandler(
{
m_TimelineDecoder.SetDefaultCallbacks();
- m_HandlerRegistry.RegisterFunctor(&m_StreamMetadataCommandHandler);
m_HandlerRegistry.RegisterFunctor(&m_CounterCaptureCommandHandler);
+ m_HandlerRegistry.RegisterFunctor(&m_StreamMetadataCommandHandler);
+ m_HandlerRegistry.RegisterFunctor(&m_StubCommandHandler);
m_HandlerRegistry.RegisterFunctor(&m_DirectoryCaptureCommandHandler);
m_HandlerRegistry.RegisterFunctor(&m_TimelineDirectoryCaptureCommandHandler);
m_HandlerRegistry.RegisterFunctor(&m_TimelineCaptureCommandHandler);
timelinedecoder::TimelineDecoder m_TimelineDecoder;
- gatordmock::StreamMetadataCommandHandler m_StreamMetadataCommandHandler;
gatordmock::PeriodicCounterCaptureCommandHandler m_CounterCaptureCommandHandler;
+ gatordmock::StreamMetadataCommandHandler m_StreamMetadataCommandHandler;
+ gatordmock::StubCommandHandler m_StubCommandHandler;
profiling::DirectoryCaptureCommandHandler m_DirectoryCaptureCommandHandler;
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
+#pragma once
#include <CommandHandlerFunctor.hpp>
#include <Packet.hpp>
namespace gatordmock
{
-#pragma once
-
class PeriodicCounterSelectionResponseHandler : public profiling::CommandHandlerFunctor
{
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+#pragma once
+
+#include <CommandHandlerFunctor.hpp>
+#include <armnn/utility/IgnoreUnused.hpp>
+
+#include <vector>
+
+namespace armnn
+{
+
+namespace gatordmock
+{
+
+class StubCommandHandler : public profiling::CommandHandlerFunctor
+{
+
+public:
+ /**
+ *
+ * @param packetId The id of packets this handler will process.
+ * @param version The version of that id.
+ */
+ StubCommandHandler(uint32_t familyId,
+ uint32_t packetId,
+ uint32_t version)
+ : CommandHandlerFunctor(familyId, packetId, version)
+ {}
+
+ void operator()(const armnn::profiling::Packet& packet) override
+ {
+ //No op
+ IgnoreUnused(packet);
+ }
+
+};
+
+} // namespace gatordmock
+} // namespace armnn
// Enable the profiling service.
armnn::IRuntime::CreationOptions::ExternalProfilingOptions options;
- options.m_EnableProfiling = true;
+ options.m_EnableProfiling = true;
+ options.m_TimelineEnabled = true;
+
armnn::profiling::ProfilingService profilingService;
profilingService.ResetExternalProfilingOptions(options, true);
armnn::IRuntime::CreationOptions options;
options.m_ProfilingOptions.m_EnableProfiling = true;
+ options.m_ProfilingOptions.m_TimelineEnabled = true;
armnn::Runtime runtime(options);
armnnUtils::Sockets::Socket clientConnection;