logging: add a LogHandler::getConfig() method
[folly.git] / folly / test / FBStringBenchmark.cpp
index 359f1b46d2f3c3982c65e17d66a29c4b0118b6cb..003eee88ad8dbcf3220a46ef2ff21f8e754758e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 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.
 #include <folly/FBString.h>
 
 #include <cstdlib>
-
-#include <list>
 #include <fstream>
-#include <boost/algorithm/string.hpp>
-#include <boost/random.hpp>
+#include <list>
+#include <sstream>
 
-#include <gflags/gflags.h>
+#include <boost/random.hpp>
 
-#include <folly/Foreach.h>
-#include <folly/Random.h>
 #include <folly/Benchmark.h>
+#include <folly/Random.h>
+#include <folly/container/Foreach.h>
+#include <folly/portability/GFlags.h>
 
 using namespace std;
 using namespace folly;
@@ -38,8 +37,6 @@ using namespace folly;
 static const int seed = folly::randomNumberSeed();
 typedef boost::mt19937 RandomT;
 static RandomT rng(seed);
-static const size_t maxString = 100;
-static const bool avoidAliasing = true;
 
 template <class Integral1, class Integral2>
 Integral2 random(Integral1 low, Integral2 up) {
@@ -48,18 +45,18 @@ Integral2 random(Integral1 low, Integral2 up) {
 }
 
 template <class String>
-void randomString(String* toFill, unsigned int maxSize = 1000) {
+void randomString(String* toFill, size_t size = 1000) {
   assert(toFill);
-  toFill->resize(random(0, maxSize));
+  toFill->resize(size);
   FOR_EACH (i, *toFill) {
     *i = random('a', 'z');
   }
 }
 
 template <class String>
-void randomBinaryString(String* toFill, unsigned int maxSize = 1000) {
+void randomBinaryString(String* toFill, size_t size = 1000) {
   assert(toFill);
-  toFill->resize(random(0, maxSize));
+  toFill->resize(size);
   FOR_EACH (i, *toFill) {
     *i = random('0', '1');
   }
@@ -86,14 +83,14 @@ std::list<char> RandomList(unsigned int maxSize) {
 #define BENCHFUN(F) CONCAT(CONCAT(BM_, F), CONCAT(_, STRING))
 
 #define STRING string
-#include <folly/test/FBStringTestBenchmarks.cpp.h>
+#include <folly/test/FBStringTestBenchmarks.cpp.h> // nolint
 #undef STRING
 #define STRING fbstring
-#include <folly/test/FBStringTestBenchmarks.cpp.h>
+#include <folly/test/FBStringTestBenchmarks.cpp.h> // nolint
 #undef STRING
 
 int main(int argc, char** argv) {
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  gflags::ParseCommandLineFlags(&argc, &argv, true);
   folly::runBenchmarks();
   return 0;
 }