aboutsummaryrefslogtreecommitdiff
path: root/src/profiling
diff options
context:
space:
mode:
Diffstat (limited to 'src/profiling')
-rw-r--r--src/profiling/SendCounterPacket.cpp4
-rw-r--r--src/profiling/test/FileOnlyProfilingDecoratorTests.cpp7
-rw-r--r--src/profiling/test/SendCounterPacketTests.cpp4
3 files changed, 9 insertions, 6 deletions
diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp
index 5128331c46..4d305af951 100644
--- a/src/profiling/SendCounterPacket.cpp
+++ b/src/profiling/SendCounterPacket.cpp
@@ -9,6 +9,7 @@
#include <armnn/Exceptions.hpp>
#include <armnn/Conversion.hpp>
+#include <Processes.hpp>
#include <boost/format.hpp>
#include <boost/numeric/conversion/cast.hpp>
@@ -90,7 +91,8 @@ void SendCounterPacket::SendStreamMetaDataPacket()
offset += sizeUint32;
WriteUint32(writeBuffer, offset, MAX_METADATA_PACKET_LENGTH); // max_data_length
offset += sizeUint32;
- WriteUint32(writeBuffer, offset, numeric_cast<uint32_t>(getpid())); // pid
+ int pid = armnnUtils::Processes::GetCurrentId();
+ WriteUint32(writeBuffer, offset, numeric_cast<uint32_t>(pid)); // pid
offset += sizeUint32;
uint32_t poolOffset = bodySize;
WriteUint32(writeBuffer, offset, infoSize ? poolOffset : 0); // offset_info
diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
index 26634704ae..4112dbac03 100644
--- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
+++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
@@ -7,6 +7,7 @@
#include <ProfilingService.hpp>
#include <Runtime.hpp>
+#include <Filesystem.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/filesystem.hpp>
@@ -94,12 +95,10 @@ BOOST_AUTO_TEST_CASE(DumpOutgoingValidFileEndToEnd)
profilingService.ResetExternalProfilingOptions(options, true);
// The output file size should be greater than 0.
- struct stat statusBuffer;
- BOOST_CHECK(stat(tempPath.c_str(), &statusBuffer) == 0);
- BOOST_CHECK(statusBuffer.st_size > 0);
+ BOOST_CHECK(armnnUtils::Filesystem::GetFileSize(tempPath.string().c_str()) > 0);
// Delete the tmp file.
- BOOST_CHECK(remove(tempPath.c_str()) == 0);
+ BOOST_CHECK(armnnUtils::Filesystem::Remove(tempPath.string().c_str()));
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp
index 19423165a9..83bffe4686 100644
--- a/src/profiling/test/SendCounterPacketTests.cpp
+++ b/src/profiling/test/SendCounterPacketTests.cpp
@@ -10,6 +10,7 @@
#include <EncodeVersion.hpp>
#include <ProfilingUtils.hpp>
#include <SendCounterPacket.hpp>
+#include <Processes.hpp>
#include <armnn/Exceptions.hpp>
#include <armnn/Conversion.hpp>
@@ -335,7 +336,8 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest)
offset += sizeUint32;
BOOST_TEST(ReadUint32(readBuffer2, offset) == MAX_METADATA_PACKET_LENGTH); // max_data_len
offset += sizeUint32;
- BOOST_TEST(ReadUint32(readBuffer2, offset) == numeric_cast<uint32_t>(getpid())); // pid
+ int pid = armnnUtils::Processes::GetCurrentId();
+ BOOST_TEST(ReadUint32(readBuffer2, offset) == numeric_cast<uint32_t>(pid));
offset += sizeUint32;
uint32_t poolOffset = 10 * sizeUint32;
BOOST_TEST(ReadUint32(readBuffer2, offset) == (infoSize ? poolOffset : 0)); // offset_info