X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ftest%2FLoggingTest.cpp;h=f0640669f590d5803be7cd0dedfe0246bd4321e8;hb=dc1c3dcc04baa70029d16351d4424af4a7ef4385;hp=ba778efbe5cc734d5af1bf530b315cae20caa808;hpb=275ca94d04e44f28cfa411668eb1c1dd8db90b80;p=folly.git diff --git a/folly/test/LoggingTest.cpp b/folly/test/LoggingTest.cpp index ba778efb..f0640669 100644 --- a/folly/test/LoggingTest.cpp +++ b/folly/test/LoggingTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2015 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. @@ -15,9 +15,9 @@ */ #include -#include -#include -#include + +#include + #include TEST(LogEveryMs, basic) { @@ -50,43 +50,3 @@ TEST(LogEveryMs, zero) { EXPECT_EQ(10, count); } - -BENCHMARK(skip_overhead, iter) { - auto prev = FLAGS_minloglevel; - FLAGS_minloglevel = 2; - - for (unsigned i = 0; i < iter; ++i) { - FB_LOG_EVERY_MS(INFO, 1000) << "every 1s"; - } - - FLAGS_minloglevel = prev; -} - -BENCHMARK(dev_null_log_overhead, iter) { - auto prev = FLAGS_minloglevel; - FLAGS_minloglevel = 2; - - for (unsigned i = 0; i < iter; ++i) { - FB_LOG_EVERY_MS(INFO, -1) << "every -1ms"; - } - - FLAGS_minloglevel = prev; -} - -// ============================================================================ -// folly/test/LoggingTest.cpp relative time/iter iters/s -// ============================================================================ -// skip_overhead 36.37ns 27.49M -// dev_null_log_overhead 2.61us 382.57K -// ============================================================================ - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - gflags::ParseCommandLineFlags(&argc, &argv, true); - - auto rv = RUN_ALL_TESTS(); - if (!rv && FLAGS_benchmark) { - folly::runBenchmarks(); - } - return rv; -}