aboutsummaryrefslogtreecommitdiff
path: root/profiling/common/src/Processes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'profiling/common/src/Processes.cpp')
-rw-r--r--profiling/common/src/Processes.cpp29
1 files changed, 29 insertions, 0 deletions
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