aboutsummaryrefslogtreecommitdiff
path: root/Utils.cpp
diff options
context:
space:
mode:
authorColm Donelan <Colm.Donelan@arm.com>2020-09-09 17:56:55 +0100
committerJan Eilers <jan.eilers@arm.com>2020-10-07 10:30:45 +0100
commit08d9a1c4c9cbea4e743feefdd310ff038a6c4588 (patch)
tree934bb78f78c4c87150e1a31461a05aca1fa0946a /Utils.cpp
parent4918446f3490e4edab86a5dc75aba3cdf74ae430 (diff)
downloadandroid-nn-driver-08d9a1c4c9cbea4e743feefdd310ff038a6c4588.tar.gz
IVGCVSW-5298 Remove boost::format from Android-nn-driver
* Replaced with stringstream, string or filesystem::path Signed-off-by: Colm Donelan <Colm.Donelan@arm.com> Signed-off-by: Jan Eilers <jan.eilers@arm.com> Change-Id: I2aa80d88cc0eaff5de4dc6a121370ebf41dcb0a8
Diffstat (limited to 'Utils.cpp')
-rw-r--r--Utils.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/Utils.cpp b/Utils.cpp
index 77575d70..895278a4 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -12,6 +12,8 @@
#include <armnn/Utils.hpp>
#include <armnn/utility/Assert.hpp>
+#include <Filesystem.hpp>
+#include <log/log.h>
#include <cassert>
#include <cerrno>
@@ -374,10 +376,11 @@ void DumpTensor(const std::string& dumpDir,
const armnn::ConstTensor& tensor)
{
// The dump directory must exist in advance.
- const std::string fileName = boost::str(boost::format("%1%/%2%_%3%.dump") % dumpDir % requestName % tensorName);
+ fs::path dumpPath = dumpDir;
+ const fs::path fileName = dumpPath / (requestName + "_" + tensorName + ".dump");
std::ofstream fileStream;
- fileStream.open(fileName, std::ofstream::out | std::ofstream::trunc);
+ fileStream.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
if (!fileStream.good())
{
@@ -512,14 +515,12 @@ void DumpJsonProfilingIfRequired(bool gpuProfilingEnabled,
ARMNN_ASSERT(profiler);
// Set the name of the output profiling file.
- const std::string fileName = boost::str(boost::format("%1%/%2%_%3%.json")
- % dumpDir
- % std::to_string(networkId)
- % "profiling");
+ fs::path dumpPath = dumpDir;
+ const fs::path fileName = dumpPath / (std::to_string(networkId) + "_profiling.json");
// Open the ouput file for writing.
std::ofstream fileStream;
- fileStream.open(fileName, std::ofstream::out | std::ofstream::trunc);
+ fileStream.open(fileName.c_str(), std::ofstream::out | std::ofstream::trunc);
if (!fileStream.good())
{
@@ -548,9 +549,9 @@ std::string ExportNetworkGraphToDotFile(const armnn::IOptimizedNetwork& optimize
}
// Set the name of the output .dot file.
- fileName = boost::str(boost::format("%1%/%2%_networkgraph.dot")
- % dumpDir
- % timestamp);
+ fs::path dumpPath = dumpDir;
+ fs::path tempFilePath = dumpPath / (timestamp + "_networkgraph.dot");
+ fileName = tempFilePath.string();
ALOGV("Exporting the optimized network graph to file: %s", fileName.c_str());
@@ -622,9 +623,9 @@ void RenameGraphDotFile(const std::string& oldName, const std::string& dumpDir,
{
return;
}
- const std::string newFileName = boost::str(boost::format("%1%/%2%_networkgraph.dot")
- % dumpDir
- % std::to_string(networkId));
+ fs::path dumpPath = dumpDir;
+ const fs::path newFileName = dumpPath / (std::to_string(networkId) + "_networkgraph.dot");
+
int iRet = rename(oldName.c_str(), newFileName.c_str());
if (iRet != 0)
{