IVGCVSW-3948 Adds External Profiling cmdline to ExecuteNetwork
authorJim Flynn <jim.flynn@arm.com>
Thu, 3 Oct 2019 17:04:30 +0000 (10:04 -0700)
committerJim Flynn Arm <jim.flynn@arm.com>
Fri, 4 Oct 2019 10:54:17 +0000 (10:54 +0000)
Change-Id: If172bcb64e8202abbde4b8a6cee14f672bc259cd
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
include/armnn/IRuntime.hpp
tests/ExecuteNetwork/ExecuteNetwork.cpp

index 68965cf..8003fd9 100644 (file)
@@ -73,6 +73,8 @@ public:
             bool        m_FileOnly;
             uint32_t    m_CapturePeriod;
         };
+
+        ExternalProfilingOptions m_ProfilingOptions;
     };
 
     static IRuntime* CreateRaw(const CreationOptions& options);
index d97a199..2309a8b 100644 (file)
@@ -30,6 +30,11 @@ int main(int argc, const char* argv[])
     std::string dynamicBackendsPath;
     std::string outputTensorFiles;
 
+    // external profiling parameters
+    std::string outgoingCaptureFile;
+    std::string incomingCaptureFile;
+    uint32_t counterCapturePeriod;
+
     double thresholdTime = 0.0;
 
     size_t subgraphId = 0;
@@ -95,7 +100,17 @@ int main(int argc, const char* argv[])
              "inference time is greater than the threshold time, the test will fail. By default, no threshold "
              "time is used.")
             ("print-intermediate-layers,p", po::bool_switch()->default_value(false),
-             "If this option is enabled, the output of every graph layer will be printed.");
+             "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")
+            ("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),
+             "If specified the incoming external profiling packets will be captured in this binary file")
+            ("file-only-external-profiling,g", po::bool_switch()->default_value(false),
+             "If enabled then the 'file-only' test mode of external profiling will be enabled")
+            ("counter-capture-period,u", po::value<uint32_t>(&counterCapturePeriod)->default_value(150u),
+             "If profiling is enabled in 'file-only' mode this is the capture period that will be used in the test");
     }
     catch (const std::exception& e)
     {
@@ -138,6 +153,8 @@ int main(int argc, const char* argv[])
     bool enableFp16TurboMode = vm["fp16-turbo-mode"].as<bool>();
     bool quantizeInput = vm["quantize-input"].as<bool>();
     bool printIntermediate = vm["print-intermediate-layers"].as<bool>();
+    bool enableExternalProfiling = vm["enable-external-profiling"].as<bool>();
+    bool fileOnlyExternalProfiling = vm["file-only-external-profiling"].as<bool>();
 
     // Check whether we have to load test cases from a file.
     if (CheckOption(vm, "test-cases"))
@@ -163,6 +180,11 @@ int main(int argc, const char* argv[])
         // Create runtime
         armnn::IRuntime::CreationOptions options;
         options.m_EnableGpuProfiling = enableProfiling;
+        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;
 
         std::shared_ptr<armnn::IRuntime> runtime(armnn::IRuntime::Create(options));