116 sort(latencies.begin(), latencies.end());
118 const std::size_t NameWidth = 23;
120 std::clog << std::setw(NameWidth) << std::left << name;
122 if(name.length() > NameWidth)
123 std::clog << std::endl << std::setw(NameWidth) <<
' ';
127 <<
"min: " << std::setw(7) << *latencies.begin()
128 <<
" median: " << std::setw(7) << latencies.at(latencies.size() / 2)
129 <<
" 99th percentile: " << std::setw(6)
130 << latencies.at(
static_cast<std::size_t
>(std::ceil((latencies.size() * 99) / 100.0)) - 1)
131 <<
" stdDev: " << std::setw(10) << std::fixed << std::setprecision(2) <<
stdDev(latencies)
137 std::size_t count,
const Overhead & overhead)
139 const std::string baseName = name +
'_';
141 std::ofstream receiveStream(std::string(baseName +
"recv.csv").c_str(), std::ios_base::ate);
142 std::ofstream sendStream(std::string(baseName +
"send.csv").c_str(), std::ios_base::ate);
143 std::ofstream overallSendStream(std::string(baseName +
"overallsend.csv").c_str(), std::ios_base::ate);
144 std::ofstream sendAndReceiveStream(std::string(baseName +
"sendrecv.csv").c_str(), std::ios_base::ate);
146#define MEASURE_NETWORK_LATENCY 1
148#if MEASURE_NETWORK_LATENCY
149 std::ofstream oneWayStream(std::string(baseName +
"oneway.csv").c_str(), std::ios_base::ate);
153 Latencies sendLatencies, overallSendLatencies, receiveLatencies, sendAndReceiveLatencies;
155 for(std::size_t i = 0; i < count; ++i)
157 const SendMarks & sendMarks = sendMarksArray[i];
158 const ReceiveMarks & receiveMarks = receiveMarksArray[i];
163 receiveStream << *receiveLatencies.rbegin() << std::endl;
166 sendStream << *sendLatencies.rbegin() << std::endl;
169 overallSendStream << *overallSendLatencies.rbegin() << std::endl;
172 sendAndReceiveLatencies.push_back(sendAndReceiveLatency);
173 sendAndReceiveStream << *sendAndReceiveLatencies.rbegin() << std::endl;
175#if MEASURE_NETWORK_LATENCY
177 oneWayStream << *oneWayLatencies.rbegin() << std::endl;
181 std::clog << std::endl << name <<
" (nanoseconds): \n" << std::endl;
187 "OS + Handler Send (depends on the network card, kernel bypass software, OS load)",
191#if MEASURE_NETWORK_LATENCY
195#define REPORT_OVERHEAD 1
199 << std::endl <<
"Measurement overhead:" << std::endl
200 <<
"Send: " << overhead.
send << std::endl
201 <<
"Receive: " << overhead.
receive << std::endl
202 <<
"Send+Receive: " << overhead.
send + overhead.
receive << std::endl
203 <<
"OS + Handler Send: " << overhead.
overallSend << std::endl;
206#if MEASURE_NETWORK_LATENCY
207 std::clog <<
"One way:" << overhead.
oneWay << std::endl;