diff options
author | Jim Flynn <jim.flynn@arm.com> | 2020-07-09 07:28:37 +0100 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-07-09 13:48:46 +0100 |
commit | 1fdeb99ca83bac83e0cacb332880e2e62dd22198 (patch) | |
tree | 76aa91baf9d3b7306b2fa15e1a50dc0bbfe3af26 /src/armnnUtils/Threads.cpp | |
parent | 86953ed331027bd557a80d782d5ee99298de35c4 (diff) | |
download | armnn-1fdeb99ca83bac83e0cacb332880e2e62dd22198.tar.gz |
IVGCVSW-5095 Make timeline report the Linux Thread ID not the pthread ID
Change-Id: Id69519fd9ef57716de4e389ed4156710a904c701
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/armnnUtils/Threads.cpp')
-rw-r--r-- | src/armnnUtils/Threads.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/armnnUtils/Threads.cpp b/src/armnnUtils/Threads.cpp new file mode 100644 index 0000000000..561edcb8b7 --- /dev/null +++ b/src/armnnUtils/Threads.cpp @@ -0,0 +1,31 @@ +// +// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "Threads.hpp" + +#if defined(__linux__) +#include <unistd.h> +#include <sys/syscall.h> +#define gettid() syscall(SYS_gettid) +#elif defined(_MSC_VER) +#include "WindowsWrapper.hpp" +#endif + +namespace armnnUtils +{ +namespace Threads +{ + +int GetCurrentThreadId() +{ +#if defined(__linux__) + return static_cast<int>(gettid()); +#elif defined(_MSC_VER) + return ::GetCurrentThreadId(); +#endif +} + +} +} |