Codemod: use #include angle brackets in folly and thrift
[folly.git] / folly / test / CacheLocalityTest.cpp
index 1d870a0a68a095599a127e57f7d76fb296b856f0..0b5322fe12f07fee31c4b022795889c3f8da30bd 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "folly/detail/CacheLocality.h"
+#include <folly/detail/CacheLocality.h>
 
 #include <sched.h>
 #include <memory>
@@ -23,7 +23,7 @@
 #include <unordered_map>
 #include <glog/logging.h>
 #include <gtest/gtest.h>
-#include "folly/Benchmark.h"
+#include <folly/Benchmark.h>
 
 using namespace folly::detail;
 
@@ -327,7 +327,7 @@ TEST(SequentialThreadId, Simple) {
   EXPECT_EQ(cpu, again);
 }
 
-static __thread unsigned testingCpu = 0;
+static FOLLY_TLS unsigned testingCpu = 0;
 
 static int testingGetcpu(unsigned* cpu, unsigned* node, void* unused) {
   if (cpu != nullptr) {
@@ -528,7 +528,7 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work,
   // that we get contention on 128 byte boundaries for Ivy Bridge.  The
   // extra indirection adds 1 or 2 nanos
   assert(counterAlignment >= sizeof(std::atomic<size_t>));
-  char raw[counterAlignment * stripes];
+  std::vector<char> raw(counterAlignment * stripes);
 
   // if we happen to be using the tlsRoundRobin, then sequentially
   // assigning the thread identifiers is the unlikely best-case scenario.
@@ -543,7 +543,8 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work,
     threads.push_back(std::thread([&,iters,stripes,work]() {
       std::atomic<size_t>* counters[stripes];
       for (size_t i = 0; i < stripes; ++i) {
-        counters[i] = new (raw + counterAlignment * i) std::atomic<size_t>();
+        counters[i]
+          = new (raw.data() + counterAlignment * i) std::atomic<size_t>();
       }
 
       spreader.current();
@@ -702,4 +703,3 @@ int main(int argc, char** argv) {
   }
   return ret;
 }
-