diff options
author | Dean Michael Berris <dberris@google.com> | 2017-02-06 01:48:21 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-02-06 01:48:21 +0000 |
commit | d7630a8049c511072ee5b72d96b850d44a73237c (patch) | |
tree | 85d62c463875f2b0a9da14c0b5c39afd6c154b1b /lib/xray/xray_fdr_logging.cc | |
parent | 63588eb7f2f0daf533c1de0c7c7eaba3e715559b (diff) |
[XRay][compiler-rt] Use gettid instead of getpid in FDR mode.
Summary:
This was pointed out that FDR mode didn't quite put the thread ID in the
buffers, but instead would write down the parent process ID.
Reviewers: pelikan, rSerge
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29484
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/xray/xray_fdr_logging.cc')
-rw-r--r-- | lib/xray/xray_fdr_logging.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/xray/xray_fdr_logging.cc b/lib/xray/xray_fdr_logging.cc index 6e67b7deb..dd88df194 100644 --- a/lib/xray/xray_fdr_logging.cc +++ b/lib/xray/xray_fdr_logging.cc @@ -20,6 +20,7 @@ #include <cassert> #include <cstring> #include <memory> +#include <sys/syscall.h> #include <sys/time.h> #include <time.h> #include <unistd.h> @@ -200,8 +201,8 @@ void setupNewBuffer(const BufferQueue::Buffer &Buffer) XRAY_NEVER_INSTRUMENT { auto &NewBuffer = *reinterpret_cast<MetadataRecord *>(&Records[0]); NewBuffer.Type = RecordType::Metadata; NewBuffer.RecordKind = MetadataRecord::RecordKinds::NewBuffer; - pid_t Pid = getpid(); - std::memcpy(&NewBuffer.Data, &Pid, sizeof(pid_t)); + pid_t Tid = syscall(SYS_gettid); + std::memcpy(&NewBuffer.Data, &Tid, sizeof(pid_t)); } // Also write the WalltimeMarker record. |