3 #include "measurementtask.h"
9 unsigned int no_conn = 4,
unsigned int max_conn = 20,
10 double duration = 10.0,
double timeout = 25.0) :
13 current_load_size(50000),
14 load_size_check(no_conn + 2),
15 current_duration(0.0),
19 else if (duration > 20.0)
22 tot_duration = duration;
27 void notifyBytesAndDuration(uint64_t count,
double duration) {
28 double mbps = addOverheadMbps(count, duration);
29 doTestProgress(mbps, duration, currentNoConnections());
32 void notifyBytesLoaded(
size_t n) {
38 void notifyStarted() {
43 void connectionLost()
override {
46 if (current_duration > tot_duration*0.5)
52 void set_speedlimit(
double limit_mbps) {
53 speedlimit_mbps = (limit_mbps < 0.5) ? 0.5 : limit_mbps;
54 if (speedlimit_mbps < 5.0)
55 current_load_size = 5000;
60 double currentDuration()
const {
61 return current_duration;
63 double currentProgress()
const {
64 return current_duration/tot_duration;
66 double currentMbps()
const {
70 uint64_t byteCount() {
76 uint64_t threadSendCount() {
82 uint64_t threadRecvCount() {
86 static double addOverheadMbps(uint64_t n,
double s) {
90 double mbps =
static_cast<double>(n) / s * 0.000008;
92 return (mbps * 1.02 + 0.16);
96 void doTestProgress(
double mbps,
double duration,
unsigned int no_conn);
97 bool soonFinished()
const {
102 uint64_t byte_count, thread_send_count = 0, thread_recv_count = 0;
103 size_t current_load_size;
104 unsigned int load_size_check, no_started_loads = 0;
105 double tot_duration, current_duration, current_mbps;
106 double speedlimit_mbps = 0.0;
107 bool soon_finished =
false;
HTTP/1.1 client protocol.
Definition: httpclientconnection.h:39
The host name and port number of a HTTP host.
Definition: httphost.h:17
std::string label() const
Return the object's log label.
Definition: logger.h:251
Definition: measurementtask.h:9
Definition: progresstask.h:5
bool requestComplete(HttpClientConnection *) override
Called when response has been fully read.
Definition: progresstask.cpp:77
static uint64_t totBytesSent()
Number of bytes sent by current thread.
Definition: socketconnection.h:203
static uint64_t totBytesReceived()
Number of bytes recieved by current thread.
Definition: socketconnection.h:208
void setResult(const std::string &res)
Definition: task.cpp:18