#include <folly/io/async/EventBase.h>
#include <gflags/gflags.h>
#include <iostream>
#include <thread>
#include <folly/io/async/AsyncSSLSocket.h>
#include <folly/io/async/AsyncSocket.h>
#include <vector>
Go to the source code of this file.
|
| DEFINE_int32 (clients, 1,"Number of simulated SSL clients") |
|
| DEFINE_int32 (threads, 1,"Number of threads to spread clients across") |
|
| DEFINE_int32 (requests, 2,"Total number of requests per client") |
|
| DEFINE_int32 (port, 9423,"Server port") |
|
| DEFINE_bool (sticky, false,"A given client sends all reqs to one ""(random) server") |
|
| DEFINE_bool (global, false,"All clients in a thread use the same SSL session") |
|
| DEFINE_bool (handshakes, false,"Force 100% handshakes") |
|
int | main (int argc, char *argv[]) |
|
DEFINE_bool |
( |
sticky |
, |
|
|
false |
, |
|
|
"A given client sends all reqs to one ""(random) server" |
|
|
) |
| |
DEFINE_bool |
( |
global |
, |
|
|
false |
, |
|
|
"All clients in a thread use the same SSL session" |
|
|
) |
| |
DEFINE_bool |
( |
handshakes |
, |
|
|
false |
, |
|
|
"Force 100% handshakes" |
|
|
) |
| |
DEFINE_int32 |
( |
clients |
, |
|
|
1 |
, |
|
|
"Number of simulated SSL clients" |
|
|
) |
| |
DEFINE_int32 |
( |
threads |
, |
|
|
1 |
, |
|
|
"Number of threads to spread clients across" |
|
|
) |
| |
DEFINE_int32 |
( |
port |
, |
|
|
9423 |
, |
|
|
"Server port" |
|
|
) |
| |
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 94 of file SSLCacheTest.cpp.
References f_num_servers, f_servers, ClientRunner::hits, i, ClientRunner::miss, ClientRunner::reqs, ClientRunner::run(), string, folly::pushmi::detail::t, threads, and folly::detail::distributed_mutex::time().
97 "usage: sslcachetest [options] -c <clients> -t <threads> servers\n" 99 gflags::ParseCommandLineFlags(&argc, &
argv,
true);
103 struct timeval
start;
105 struct timeval result;
107 srand((
unsigned int)
time(
nullptr));
109 for (
int i = 1;
i < argc;
i++) {
113 cout <<
"require at least one server\n";
117 gettimeofday(&
start,
nullptr);
118 if (FLAGS_threads == 1) {
121 gettimeofday(&
end,
nullptr);
127 std::vector<ClientRunner> clients;
128 std::vector<std::thread>
threads;
129 for (
int t = 0;
t < FLAGS_threads;
t++) {
130 threads.emplace_back([&] {
134 for (
auto& thr: threads) {
137 gettimeofday(&
end,
nullptr);
139 for (
const auto& client: clients) {
148 cout <<
"Requests: " << reqs << endl;
149 cout <<
"Handshakes: " << miss << endl;
150 cout <<
"Resumes: " << hits << endl;
151 cout <<
"Runtime(ms): " << result.tv_sec <<
"." << result.tv_usec / 1000 <<
154 cout <<
"ops/sec: " << (reqs * 1.0) /
155 ((double)result.tv_sec * 1.0 + (
double)result.tv_usec / 1000000.0) << endl;
std::vector< std::thread::id > threads
auto end(TestAdlIterable &instance)
std::chrono::nanoseconds time()