forked from taganaka/SpeedTest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestConfigTemplate.h
120 lines (102 loc) · 3.43 KB
/
TestConfigTemplate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
// Created by Francesco Laurita on 6/2/16.
//
#ifndef SPEEDTEST_TESTCONFIGTEMPLATE_H
#define SPEEDTEST_TESTCONFIGTEMPLATE_H
#include "SpeedTest.h"
const TestConfig preflightConfigDownload = {
600000, // start_size
2000000, // max_size
125000, // inc_size
4096, // buff_size
10000, // min_test_time_ms
2, // Concurrency
"Preflight check"
};
const TestConfig slowConfigDownload = {
100000, // start_size
500000, // max_size
10000, // inc_size
1024, // buff_size
20000, // min_test_time_ms
2, // Concurrency
"Very-slow-line line type detected: profile selected slowband"
};
const TestConfig slowConfigUpload = {
50000, // start_size
80000, // max_size
1000, // inc_size
1024, // buff_size
20000, // min_test_time_ms
2, // Concurrency
"Very-slow-line line type detected: profile selected slowband"
};
const TestConfig narrowConfigDownload = {
1000000, // start_size
100000000, // max_size
750000, // inc_size
4096, // buff_size
20000, // min_test_time_ms
2, // Concurrency
"Buffering-lover line type detected: profile selected narrowband"
};
const TestConfig narrowConfigUpload = {
1000000, // start_size
100000000, // max_size
550000, // inc_size
4096, // buff_size
20000, // min_test_time_ms
2, // Concurrency
"Buffering-lover line type detected: profile selected narrowband"
};
const TestConfig broadbandConfigDownload = {
1000000, // start_size
100000000, // max_size
750000, // inc_size
65536, // buff_size
20000, // min_test_time_ms
32, // concurrency
"Broadband line type detected: profile selected broadband"
};
const TestConfig broadbandConfigUpload = {
1000000, // start_size
70000000, // max_size
250000, // inc_size
65536, // buff_size
20000, // min_test_time_ms
8, // concurrency
"Broadband line type detected: profile selected broadband"
};
const TestConfig fiberConfigDownload = {
5000000, // start_size
120000000, // max_size
950000, // inc_size
65536, // buff_size
20000, // min_test_time_ms
32, // concurrency
"Fiber / Lan line type detected: profile selected fiber"
};
const TestConfig fiberConfigUpload = {
1000000, // start_size
70000000, // max_size
250000, // inc_size
65536, // buff_size
20000, // min_test_time_ms
12, // concurrency
"Fiber / Lan line type detected: profile selected fiber"
};
void testConfigSelector(const double preSpeed, TestConfig& uploadConfig, TestConfig& downloadConfig){
uploadConfig = slowConfigUpload;
downloadConfig = slowConfigDownload;
if (preSpeed > 4 && preSpeed <= 30){
downloadConfig = narrowConfigDownload;
uploadConfig = narrowConfigUpload;
} else if (preSpeed > 30 && preSpeed < 150) {
downloadConfig = broadbandConfigDownload;
uploadConfig = broadbandConfigUpload;
} else if (preSpeed >= 150) {
downloadConfig = fiberConfigDownload;
uploadConfig = fiberConfigUpload;
}
}
#endif //SPEEDTEST_TESTCONFIGTEMPLATE_H