21 #include <glog/logging.h> 27 DEFINE_bool(direct,
false,
"run direct measurement");
32 DEFINE_int32(work, 1000,
"amount of unrelated work per operation");
34 static std::vector<int>
nthr = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64};
342 int numCores = std::thread::hardware_concurrency();
343 std::cout <<
"\nRunning benchmarks on machine with " << numCores
344 <<
" logical cores" << std::endl;
347 TEST(FlatCombining, folly_benchmark) {
348 if (FLAGS_benchmark) {
350 for (
bool b : {
true,
false}) {
353 std::cout <<
"\n------------------------------------ " << str
354 <<
" interface" << std::endl;
356 std::cout <<
"\n---------------------------------- Number of threads = " 378 for (
int i = 0;
i < FLAGS_reps; ++
i) {
398 std::cout <<
" " << std::setw(4) << max / FLAGS_ops <<
" ns";
399 std::cout <<
" " << std::setw(4) << avg / FLAGS_ops <<
" ns";
400 std::cout <<
" " << std::setw(4) << res / FLAGS_ops <<
" ns";
402 std::cout <<
" " << std::setw(3) << 100 * base / res <<
"%";
404 std::cout << std::endl;
408 TEST(FlatCombining, direct_measurement) {
415 std::cout <<
"\n------------------------------------ " << str <<
" interface" 419 std::cout <<
"\n------------------------------------ Number of threads = " 422 std::cout <<
"Test_name, Max time, Avg time, Min time, % base min / min\n" 426 test(
"no_combining - base ",
false,
false,
false,
false, 0);
427 test(
"no_combining - dup ",
false,
false,
false,
false, base);
428 std::cout <<
"---------------------------------------" << std::endl;
430 std::cout <<
"---- dedicated-------------------------" << std::endl;
431 test(
"combining_notc_sync ",
true,
true,
false,
true, base);
432 test(
"combining_notc_sync - dup ",
true,
true,
false,
true, base);
433 std::cout <<
"---------------------------------------" << std::endl;
434 test(
"combining_notc_async ",
true,
true,
false,
false, base);
435 test(
"combining_notc_async - dup ",
true,
true,
false,
false, base);
436 std::cout <<
"---------------------------------------" << std::endl;
437 test(
"combining_tc_sync ",
true,
true,
true,
true, base);
438 test(
"combining_tc_sync - dup ",
true,
true,
true,
true, base);
439 std::cout <<
"---------------------------------------" << std::endl;
440 test(
"combining_tc_async ",
true,
true,
true,
false, base);
441 test(
"combining_tc_async - dup ",
true,
true,
true,
false, base);
442 std::cout <<
"---------------------------------------" << std::endl;
444 std::cout <<
"---- no dedicated----------------------" << std::endl;
445 test(
"combining_notc_sync ",
true,
false,
false,
true, base);
446 test(
"combining_notc_sync - dup ",
true,
false,
false,
true, base);
447 std::cout <<
"---------------------------------------" << std::endl;
448 test(
"combining_notc_async ",
true,
false,
false,
false, base);
449 test(
"combining_notc_async - dup ",
true,
false,
false,
false, base);
450 std::cout <<
"---------------------------------------" << std::endl;
451 test(
"combining_tc_sync ",
true,
false,
true,
true, base);
452 test(
"combining_tc_sync - dup ",
true,
false,
true,
true, base);
453 std::cout <<
"---------------------------------------" << std::endl;
454 test(
"combining_tc_async ",
true,
false,
true,
false, base);
455 test(
"combining_tc_async - dup ",
true,
false,
true,
false, base);
456 std::cout <<
"---------------------------------------" << std::endl;
DEFINE_int32(reps, 10,"number of reps")
std::atomic< int64_t > sum(0)
BENCHMARK_RELATIVE(no_combining_dup, iters)
DEFINE_bool(direct, false,"run direct measurement")
uint64_t run_test(int nthreads, int lines, int numRecs, int work, int ops, bool combining, bool simple, bool dedicated, bool tc, bool syncops, bool excl=false, bool allocAll=false)
static uint64_t test(std::string name, bool fc_, bool dedicated_, bool tc_, bool syncops_, uint64_t base)
S lines(StringPiece source)
static std::vector< int > nthr
TEST(ProgramOptionsTest, Errors)
BENCHMARK(fbFollyGlobalBenchmarkBaseline)