aboutsummaryrefslogtreecommitdiff
path: root/profiling/common
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2022-03-13 20:53:35 +0000
committerJim Flynn <jim.flynn@arm.com>2022-03-13 22:50:47 +0000
commit77b284e6988b9a131d6abb3140ec6663c2ae84ae (patch)
tree72e74d3e5cde875b4f891b81ba47b0c5cc54d081 /profiling/common
parent4a96211d72002d39df0444b6f2cb56917accb80a (diff)
downloadarmnn-77b284e6988b9a131d6abb3140ec6663c2ae84ae.tar.gz
IVGCVSW-6848 Move Process.[ch]pp from armnnUtils to profiling/common
Change-Id: I13353f50293eae565a75ccfda37209350512bbc6 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'profiling/common')
-rw-r--r--profiling/common/include/Processes.hpp16
-rw-r--r--profiling/common/src/CMakeLists.txt1
-rw-r--r--profiling/common/src/Processes.cpp29
3 files changed, 46 insertions, 0 deletions
diff --git a/profiling/common/include/Processes.hpp b/profiling/common/include/Processes.hpp
new file mode 100644
index 0000000000..cc59d8b2d4
--- /dev/null
+++ b/profiling/common/include/Processes.hpp
@@ -0,0 +1,16 @@
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+namespace arm
+{
+namespace pipe
+{
+
+int GetCurrentId();
+
+} // namespace arm
+} // namespace pipe
diff --git a/profiling/common/src/CMakeLists.txt b/profiling/common/src/CMakeLists.txt
index 1b47b6cf73..3932186c51 100644
--- a/profiling/common/src/CMakeLists.txt
+++ b/profiling/common/src/CMakeLists.txt
@@ -13,6 +13,7 @@ if(BUILD_TIMELINE_DECODER)
Logging.cpp
NetworkSockets.cpp
PacketVersionResolver.cpp
+ Processes.cpp
SwTrace.cpp
LabelsAndEventClasses.cpp)
diff --git a/profiling/common/src/Processes.cpp b/profiling/common/src/Processes.cpp
new file mode 100644
index 0000000000..d6d4ca4950
--- /dev/null
+++ b/profiling/common/src/Processes.cpp
@@ -0,0 +1,29 @@
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "Processes.hpp"
+
+#if defined(__unix__) || defined(__APPLE__)
+#include <unistd.h>
+#elif defined(_MSC_VER)
+#include <common/include/WindowsWrapper.hpp>
+#endif
+
+namespace arm
+{
+namespace pipe
+{
+
+int GetCurrentId()
+{
+#if defined(__unix__) || defined(__APPLE__)
+ return getpid();
+#elif defined(_MSC_VER)
+ return ::GetCurrentProcessId();
+#endif
+}
+
+} // namespace pipe
+} // namespace arm