Sort #include lines
[folly.git] / folly / gen / test / FileBenchmark.cpp
index 339fd293ad30aa9993a017e5d38d9e54c355f6b8..74693c51ed536d47cd2769e95852437b06f17b3f 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.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #include <thread>
+
 #include <glog/logging.h>
 
-#include "folly/Benchmark.h"
-#include "folly/File.h"
-#include "folly/gen/Base.h"
-#include "folly/gen/File.h"
+#include <folly/Benchmark.h>
+#include <folly/File.h>
+#include <folly/gen/Base.h>
+#include <folly/gen/File.h>
 
 using namespace folly::gen;
 
 BENCHMARK(ByLine_Pipes, iters) {
   std::thread thread;
-  int rfd;
+  int rfd = -1;
   int wfd;
   BENCHMARK_SUSPEND {
     int p[2];
@@ -37,8 +39,8 @@ BENCHMARK(ByLine_Pipes, iters) {
       PCHECK(::write(wfd, &x, 1) == 1);  // signal startup
       FILE* f = fdopen(wfd, "w");
       PCHECK(f);
-      for (int i = 1; i <= iters; ++i) {
-        fprintf(f, "%d\n", i);
+      for (size_t i = 1; i <= iters; ++i) {
+        fprintf(f, "%zu\n", i);
       }
       fclose(f);
     });
@@ -46,6 +48,7 @@ BENCHMARK(ByLine_Pipes, iters) {
     PCHECK(::read(rfd, &buf, 1) == 1);  // wait for startup
   }
 
+  CHECK_ERR(rfd);
   auto s = byLine(folly::File(rfd)) | eachTo<int64_t>() | sum;
   folly::doNotOptimizeAway(s);
 
@@ -64,7 +67,7 @@ BENCHMARK(ByLine_Pipes, iters) {
 // ============================================================================
 
 int main(int argc, char *argv[]) {
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  gflags::ParseCommandLineFlags(&argc, &argv, true);
   folly::runBenchmarks();
   return 0;
 }