[PATCH] D29484: [XRay][compiler-rt] Use gettid instead of getpid in FDR mode.
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 2 22:49:24 PST 2017
dberris created this revision.
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.
https://reviews.llvm.org/D29484
Files:
lib/xray/xray_fdr_logging.cc
Index: lib/xray/xray_fdr_logging.cc
===================================================================
--- lib/xray/xray_fdr_logging.cc
+++ 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 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29484.86938.patch
Type: text/x-patch
Size: 769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170203/7f825e8a/attachment.bin>
More information about the llvm-commits
mailing list