X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fio%2Fasync%2Ftest%2FTimeUtil.cpp;h=74ac884c1dfc2b10ced58ce8379df5b28d705fb2;hp=8103fcc5c3790358a7c6f5b1b1f4bbc78e0695b3;hb=ed8c80a0e0988e4ce687f51ca832a00e4a6b7930;hpb=35fcff936a0ba58986269fb05689843f99e89eb5 diff --git a/folly/io/async/test/TimeUtil.cpp b/folly/io/async/test/TimeUtil.cpp index 8103fcc5..74ac884c 100644 --- a/folly/io/async/test/TimeUtil.cpp +++ b/folly/io/async/test/TimeUtil.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,25 +19,35 @@ #include +#include +#include +#include +#include +#ifndef _MSC_VER +#include +#endif + +#include +#include +#include + #include #include #include +#include -#include -#include -#include -#include -#include #include -#include -#include -#include using std::string; 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. */ @@ -105,6 +115,7 @@ static int64_t determineJiffiesHZ() { return hz; } +#endif /** * Determine how long this process has spent waiting to get scheduled on the @@ -114,6 +125,9 @@ static int64_t determineJiffiesHZ() { * time cannot be determined. */ static milliseconds getTimeWaitingMS(pid_t tid) { +#ifdef _MSC_VER + return milliseconds(0); +#else static int64_t jiffiesHZ = 0; if (jiffiesHZ == 0) { jiffiesHZ = determineJiffiesHZ(); @@ -168,6 +182,7 @@ static milliseconds getTimeWaitingMS(pid_t tid) { LOG(ERROR) << "error determining process wait time: %s" << e.what(); return milliseconds(0); } +#endif } void TimePoint::reset() {