proxygen
ZeroCopyBenchmark.cpp File Reference

Go to the source code of this file.

Functions

void zeroCopyOn (unsigned iters, size_t bufferSize, size_t numClients=1)
 
void zeroCopyOff (unsigned iters, size_t bufferSize, size_t numClients=1)
 
void zeroCopyOnMulti (unsigned iters, size_t bufferSize)
 
void zeroCopyOffMulti (unsigned iters, size_t bufferSize)
 
 BENCHMARK_DRAW_LINE ()
 
 DEFINE_bool (client, false,"client mode")
 
 DEFINE_bool (server, false,"server mode")
 
 DEFINE_bool (zeroCopy, false,"use zerocopy")
 
 DEFINE_int32 (numLoops, kMaxLoops,"number of loops")
 
 DEFINE_int32 (bufferSize, 524288,"buffer size")
 
 DEFINE_int32 (port, 33130,"port")
 
 DEFINE_string (host,"::1","host")
 
int main (int argc, char **argv)
 

Variables

static auto constexpr kMaxLoops = 20000
 
static auto constexpr kNumClients = 40
 

Function Documentation

BENCHMARK_DRAW_LINE ( )
DEFINE_bool ( client  ,
false  ,
"client mode  
)

Referenced by zeroCopyOffMulti().

DEFINE_bool ( server  ,
false  ,
"server mode  
)
DEFINE_bool ( zeroCopy  ,
false  ,
"use zerocopy"   
)
DEFINE_int32 ( numLoops  ,
kMaxLoops  ,
"number of loops"   
)

Referenced by zeroCopyOffMulti().

DEFINE_int32 ( bufferSize  ,
524288  ,
"buffer size"   
)
DEFINE_int32 ( port  ,
33130  ,
"port"   
)
DEFINE_string ( host  ,
"::1"  ,
"host"   
)

Referenced by zeroCopyOffMulti().

int main ( int  argc,
char **  argv 
)

Definition at line 132 of file ZeroCopyBenchmark.cpp.

References folly::runBenchmarks().

132  {
133  gflags::ParseCommandLineFlags(&argc, &argv, true);
134 
135  if (FLAGS_client) {
136  runClient(
137  FLAGS_host,
138  FLAGS_port,
139  FLAGS_numLoops,
140  FLAGS_zeroCopy,
141  FLAGS_bufferSize);
142  } else if (FLAGS_server) {
143  runServer(FLAGS_port, FLAGS_numLoops, FLAGS_zeroCopy, FLAGS_bufferSize);
144  } else {
145  runBenchmarks();
146  }
147 }
void runBenchmarks()
Definition: Benchmark.cpp:456
char ** argv
void zeroCopyOff ( unsigned  iters,
size_t  bufferSize,
size_t  numClients = 1 
)

Definition at line 75 of file ZeroCopyBenchmark.cpp.

References folly::BenchmarkSuspender::dismiss(), folly::BenchmarkSuspender::rehire(), folly::ZeroCopyTest::run(), and test().

Referenced by zeroCopyOffMulti().

75  {
76  BenchmarkSuspender susp;
77  ZeroCopyTest test(numClients, iters, false, bufferSize);
78  susp.dismiss();
79  test.run();
80  susp.rehire();
81 }
static uint64_t test(std::string name, bool fc_, bool dedicated_, bool tc_, bool syncops_, uint64_t base)
void zeroCopyOffMulti ( unsigned  iters,
size_t  bufferSize 
)

Definition at line 89 of file ZeroCopyBenchmark.cpp.

References folly::BENCHMARK_DRAW_LINE(), BENCHMARK_PARAM, DEFINE_bool(), DEFINE_int32(), DEFINE_string(), zeroCopyOff(), zeroCopyOn(), and zeroCopyOnMulti().

89  {
90  zeroCopyOff(iters, bufferSize, kNumClients);
91 }
static auto constexpr kNumClients
void zeroCopyOff(unsigned iters, size_t bufferSize, size_t numClients=1)
void zeroCopyOn ( unsigned  iters,
size_t  bufferSize,
size_t  numClients = 1 
)

Definition at line 67 of file ZeroCopyBenchmark.cpp.

References folly::BenchmarkSuspender::dismiss(), folly::BenchmarkSuspender::rehire(), folly::ZeroCopyTest::run(), and test().

Referenced by zeroCopyOffMulti(), and zeroCopyOnMulti().

67  {
68  BenchmarkSuspender susp;
69  ZeroCopyTest test(numClients, iters, true, bufferSize);
70  susp.dismiss();
71  test.run();
72  susp.rehire();
73 }
static uint64_t test(std::string name, bool fc_, bool dedicated_, bool tc_, bool syncops_, uint64_t base)
void zeroCopyOnMulti ( unsigned  iters,
size_t  bufferSize 
)

Definition at line 85 of file ZeroCopyBenchmark.cpp.

References zeroCopyOn().

Referenced by zeroCopyOffMulti().

85  {
86  zeroCopyOn(iters, bufferSize, kNumClients);
87 }
static auto constexpr kNumClients
void zeroCopyOn(unsigned iters, size_t bufferSize, size_t numClients=1)

Variable Documentation

auto constexpr kMaxLoops = 20000
static

Definition at line 65 of file ZeroCopyBenchmark.cpp.

auto constexpr kNumClients = 40
static

Definition at line 83 of file ZeroCopyBenchmark.cpp.