Commit c2bd7be5 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

update TimeUtil to use getOSThreadID()

Summary:
Use the newly introduced getOSThreadID() function to get a thread ID for
determining thread scheduling information on Linux.

Reviewed By: yfeldblum

Differential Revision: D5173596

fbshipit-source-id: 3e6fa352c3774986b0ac1f93bd6c7e4a29e08471
parent 68f55ed0
......@@ -23,7 +23,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifndef _MSC_VER
#ifdef __linux__
#include <sys/utsname.h>
#endif
......@@ -33,9 +33,8 @@
#include <folly/Conv.h>
#include <folly/ScopeGuard.h>
#include <folly/portability/SysSyscall.h>
#include <folly/ThreadId.h>
#include <folly/portability/Unistd.h>
#include <folly/portability/Windows.h>
#include <glog/logging.h>
......@@ -44,19 +43,6 @@ using namespace std::chrono;
namespace folly {
#ifdef _MSC_VER
static pid_t gettid() {
return pid_t(GetCurrentThreadId());
}
#else
/**
* glibc doesn't provide gettid(), so define it ourselves.
*/
static pid_t gettid() {
return syscall(FOLLY_SYS_gettid);
}
#endif
static int getLinuxVersion(StringPiece release) {
auto dot1 = release.find('.');
if (dot1 == StringPiece::npos) {
......@@ -231,7 +217,7 @@ void TimePoint::reset() {
timeStart_ = system_clock::now();
// Remember how long this process has spent waiting to be scheduled
tid_ = gettid();
tid_ = getOSThreadID();
timeWaiting_ = getTimeWaitingMS(tid_);
// In case it took a while to read the schedstat info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment