From 5ac6f421869e17a71dfcd822991863c98e5b592b Mon Sep 17 00:00:00 2001 From: Jonathan Viney Date: Wed, 5 Feb 2020 12:37:00 +1300 Subject: [PATCH 01/16] Add CURLOPT_ACCEPT_ENCODING option to fix errors downloading server list. --- SpeedTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SpeedTest.cpp b/SpeedTest.cpp index ed88406..4a13347 100644 --- a/SpeedTest.cpp +++ b/SpeedTest.cpp @@ -297,7 +297,8 @@ CURL *SpeedTest::curl_setup(CURL *handler) { if (curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &writeFunc) == CURLE_OK && curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L) == CURLE_OK && curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L) == CURLE_OK - && curl_easy_setopt(curl, CURLOPT_USERAGENT, SPEED_TEST_USER_AGENT) == CURLE_OK){ + && curl_easy_setopt(curl, CURLOPT_USERAGENT, SPEED_TEST_USER_AGENT) == CURLE_OK + && curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "br, gzip, deflate") == CURLE_OK) { return curl; } else { curl_easy_cleanup(handler); @@ -549,4 +550,3 @@ bool SpeedTest::testLatency(SpeedTestClient &client, const int sample_size, long } return true; } - From a86961e80bcd4a888c579d4925c72067b8bd21dd Mon Sep 17 00:00:00 2001 From: Jonathan Viney Date: Wed, 5 Feb 2020 12:54:53 +1300 Subject: [PATCH 02/16] Version bump --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4383d29..0571e1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.7) project(SpeedTest) set (SpeedTest_VERSION_MAJOR 1) -set (SpeedTest_VERSION_MINOR 14) +set (SpeedTest_VERSION_MINOR 15) set (SpeedTest_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) set (SpeedTest_SYSTEM ${CMAKE_SYSTEM}) From fa0d31de523ca2d0bcb7c17ab9564e85d5d4342a Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 07:42:50 +0800 Subject: [PATCH 03/16] Change conversion of megabits to mebibits --- .gitignore | 31 ++++++++++++++++++++++++++++++- SpeedTest.cpp | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9279f68..887f3c7 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,33 @@ cmake-build-debug/ cmake-build-linux/ # Visual Studio 2015/2017 cache/options directory -.vs/ \ No newline at end of file +.vs/ +cmake_install.cmake +CMakeCache.txt +install_manifest.txt +Makefile +SpeedTest +SpeedTestConfig.h +CMakeFiles/cmake.check_cache +CMakeFiles/CMakeDirectoryInformation.cmake +CMakeFiles/CMakeOutput.log +CMakeFiles/Makefile.cmake +CMakeFiles/Makefile2 +CMakeFiles/progress.marks +CMakeFiles/TargetDirectories.txt +CMakeFiles/3.16.3/CMakeCCompiler.cmake +CMakeFiles/3.16.3/CMakeCXXCompiler.cmake +CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin +CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin +CMakeFiles/3.16.3/CMakeSystem.cmake +CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c +CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp +CMakeFiles/SpeedTest.dir/build.make +CMakeFiles/SpeedTest.dir/cmake_clean.cmake +CMakeFiles/SpeedTest.dir/CXX.includecache +CMakeFiles/SpeedTest.dir/depend.internal +CMakeFiles/SpeedTest.dir/depend.make +CMakeFiles/SpeedTest.dir/DependInfo.cmake +CMakeFiles/SpeedTest.dir/flags.make +CMakeFiles/SpeedTest.dir/link.txt +CMakeFiles/SpeedTest.dir/progress.make diff --git a/SpeedTest.cpp b/SpeedTest.cpp index ed88406..cf1bca7 100644 --- a/SpeedTest.cpp +++ b/SpeedTest.cpp @@ -236,7 +236,7 @@ double SpeedTest::execute(const ServerInfo &server, const TestConfig &config, co workers.clear(); - return overall_speed / 1000 / 1000; + return overall_speed / 1024 / 1024; } template From b6d4a8e0df98d101af76e992021400f5ff9bf67e Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 08:59:01 +0800 Subject: [PATCH 04/16] Increased precision for latency and jitter --- SpeedTest.cpp | 28 ++++++++++++++-------------- SpeedTest.h | 10 +++++----- SpeedTestClient.cpp | 5 +++-- SpeedTestClient.h | 2 +- main.cpp | 2 +- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/SpeedTest.cpp b/SpeedTest.cpp index cf1bca7..1a71727 100644 --- a/SpeedTest.cpp +++ b/SpeedTest.cpp @@ -97,19 +97,19 @@ bool SpeedTest::uploadSpeed(const ServerInfo &server, const TestConfig &config, return true; } -const long &SpeedTest::latency() { +const double &SpeedTest::latency() { return mLatency; } -bool SpeedTest::jitter(const ServerInfo &server, long& result, const int sample) { +bool SpeedTest::jitter(const ServerInfo &server, double& result, const int sample) { auto client = SpeedTestClient(server); double current_jitter = 0; - long previous_ms = LONG_MAX; + double previous_ms = DBL_MAX; if (client.connect()){ for (int i = 0; i < sample; i++){ - long ms = 0; + double ms = 0; if (client.ping(ms)){ - if (previous_ms == LONG_MAX) { + if (previous_ms == DBL_MAX) { previous_ms = ms; } else { current_jitter += std::abs(previous_ms - ms); @@ -121,21 +121,21 @@ bool SpeedTest::jitter(const ServerInfo &server, long& result, const int sample) return false; } - result = (long) std::floor(current_jitter / sample); + result = current_jitter / sample; return true; } bool SpeedTest::share(const ServerInfo& server, std::string& image_url) { std::stringstream hash; - hash << std::setprecision(0) << std::fixed << mLatency + hash << std::setprecision(2) << std::fixed << (mLatency / 1000) << "-" << std::setprecision(2) << std::fixed << (mUploadSpeed * 1000) << "-" << std::setprecision(2) << std::fixed << (mDownloadSpeed * 1000) << "-" << SPEED_TEST_API_KEY; std::string hex_digest = MD5Util::hexDigest(hash.str()); std::stringstream post_data; post_data << "download=" << std::setprecision(2) << std::fixed << (mDownloadSpeed * 1000) << "&"; - post_data << "ping=" << std::setprecision(0) << std::fixed << mLatency << "&"; + post_data << "ping=" << std::setprecision(2) << std::fixed << (mLatency / 1000) << "&"; post_data << "upload=" << std::setprecision(2) << std::fixed << (mUploadSpeed * 1000) << "&"; post_data << "pingselect=1&"; post_data << "recommendedserverid=" << server.id << "&"; @@ -492,12 +492,12 @@ bool SpeedTest::fetchServers(const std::string& url, std::vector& ta return true; } -const ServerInfo SpeedTest::findBestServerWithin(const std::vector &serverList, long &latency, +const ServerInfo SpeedTest::findBestServerWithin(const std::vector &serverList, double &latency, const int sample_size, std::function cb) { int i = sample_size; ServerInfo bestServer = serverList[0]; - latency = INT_MAX; + latency = DBL_MAX; for (auto &server : serverList){ auto client = SpeedTestClient(server); @@ -513,7 +513,7 @@ const ServerInfo SpeedTest::findBestServerWithin(const std::vector & continue; } - long current_latency = LONG_MAX; + double current_latency = DBL_MAX; if (testLatency(client, 20, current_latency)){ if (current_latency < latency){ latency = current_latency; @@ -532,12 +532,12 @@ const ServerInfo SpeedTest::findBestServerWithin(const std::vector & return bestServer; } -bool SpeedTest::testLatency(SpeedTestClient &client, const int sample_size, long &latency) { +bool SpeedTest::testLatency(SpeedTestClient &client, const int sample_size, double &latency) { if (!client.connect()){ return false; } - latency = INT_MAX; - long temp_latency = 0; + latency = DBL_MAX; + double temp_latency = 0; for (int i = 0; i < sample_size; i++){ if (client.ping(temp_latency)){ if (temp_latency < latency){ diff --git a/SpeedTest.h b/SpeedTest.h index 9b8c8ce..da7c16d 100644 --- a/SpeedTest.h +++ b/SpeedTest.h @@ -38,15 +38,15 @@ class SpeedTest { const std::vector& serverList(); const ServerInfo bestServer(int sample_size = 5, std::function cb = nullptr); bool setServer(ServerInfo& server); - const long &latency(); + const double &latency(); bool downloadSpeed(const ServerInfo& server, const TestConfig& config, double& result, std::function cb = nullptr); bool uploadSpeed(const ServerInfo& server, const TestConfig& config, double& result, std::function cb = nullptr); - bool jitter(const ServerInfo& server, long& result, int sample = 40); + bool jitter(const ServerInfo& server, double& result, int sample = 40); bool share(const ServerInfo& server, std::string& image_url); private: bool fetchServers(const std::string& url, std::vector& target, int &http_code); - bool testLatency(SpeedTestClient& client, int sample_size, long& latency); - const ServerInfo findBestServerWithin(const std::vector& serverList, long& latency, int sample_size = 5, std::function cb = nullptr); + bool testLatency(SpeedTestClient& client, int sample_size, double& latency); + const ServerInfo findBestServerWithin(const std::vector& serverList, double& latency, int sample_size = 5, std::function cb = nullptr); static CURL* curl_setup(CURL* curl = nullptr); static size_t writeFunc(void* buf, size_t size, size_t nmemb, void* userp); static ServerInfo processServerXMLNode(xmlTextReaderPtr reader); @@ -58,7 +58,7 @@ class SpeedTest { IPInfo mIpInfo; std::vector mServerList; - long mLatency; + double mLatency; double mUploadSpeed; double mDownloadSpeed; float mMinSupportedServer; diff --git a/SpeedTestClient.cpp b/SpeedTestClient.cpp index 39ffc14..e6fa20e 100644 --- a/SpeedTestClient.cpp +++ b/SpeedTestClient.cpp @@ -63,7 +63,7 @@ void SpeedTestClient::close() { } // It executes PING command -bool SpeedTestClient::ping(long &millisec) { +bool SpeedTestClient::ping(double &millisec) { if (!mSocketFd) return false; @@ -80,7 +80,8 @@ bool SpeedTestClient::ping(long &millisec) { if (SpeedTestClient::readLine(mSocketFd, reply)){ if (reply.substr(0, 5) == "PONG "){ auto stop = std::chrono::steady_clock::now(); - millisec = std::chrono::duration_cast(stop - start).count(); + double microsec = std::chrono::duration_cast(stop - start).count(); + millisec = microsec / 1000; return true; } } diff --git a/SpeedTestClient.h b/SpeedTestClient.h index 141ecf4..125dee8 100644 --- a/SpeedTestClient.h +++ b/SpeedTestClient.h @@ -22,7 +22,7 @@ class SpeedTestClient { ~SpeedTestClient(); bool connect(); - bool ping(long &millisec); + bool ping(double &millisec); bool upload(long size, long chunk_size, long &millisec); bool download(long size, long chunk_size, long &millisec); float version(); diff --git a/main.cpp b/main.cpp index 8582921..e1e26f6 100644 --- a/main.cpp +++ b/main.cpp @@ -163,7 +163,7 @@ int main(const int argc, const char **argv) { std::cout << sp.latency() << "\","; } - long jitter = 0; + double jitter = 0; if (programOptions.output_type == OutputType::verbose) std::cout << "Jitter: " << std::flush; if (sp.jitter(serverInfo, jitter)){ From 39faf14aee6c4e26f7d72c1b54a24629f991a5b7 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 12:25:25 +0800 Subject: [PATCH 05/16] Added line-type option --- CmdOptions.h | 21 +++++++++++++++++ TestConfigTemplate.h | 44 ++++++++++++++++++++++++++++++++++ main.cpp | 56 ++++++++++++++++++++++++++++++-------------- 3 files changed, 103 insertions(+), 18 deletions(-) diff --git a/CmdOptions.h b/CmdOptions.h index 79ddf3a..e8a1ea4 100644 --- a/CmdOptions.h +++ b/CmdOptions.h @@ -7,6 +7,7 @@ #include enum OutputType { verbose, text, json }; +enum LineType { automatic, slow, narrow, broad, fiber }; typedef struct program_options_t { @@ -17,6 +18,7 @@ typedef struct program_options_t { bool share = false; std::string selected_server = ""; OutputType output_type = OutputType::verbose; + LineType line_type = LineType::automatic; } ProgramOptions; static struct option CmdLongOptions[] = { @@ -27,6 +29,7 @@ static struct option CmdLongOptions[] = { {"share", no_argument, 0, 's' }, {"test-server", required_argument, 0, 't' }, {"output", required_argument, 0, 'o' }, + {"line-type", required_argument, 0, 'i' }, {0, 0, 0, 0 } }; @@ -68,6 +71,24 @@ bool ParseOptions(const int argc, const char **argv, ProgramOptions& options){ return false; } + break; + case 'i': + if (strcmp(optarg, "auto") == 0) + options.line_type = LineType::automatic; + else if (strcmp(optarg, "slow") == 0) + options.line_type = LineType::slow; + else if (strcmp(optarg, "narrow") == 0) + options.line_type = LineType::narrow; + else if (strcmp(optarg, "broad") == 0) + options.line_type = LineType::broad; + else if (strcmp(optarg, "fiber") == 0) + options.line_type = LineType::fiber; + else { + std::cerr << "Unsupported line type " << optarg << std::endl; + std::cerr << "Supported line type: auto, slow, narrow, broad, fiber" < Date: Wed, 28 Apr 2021 12:45:22 +0800 Subject: [PATCH 06/16] Increase precision for download/upload timers --- SpeedTest.cpp | 4 ++-- SpeedTest.h | 2 +- SpeedTestClient.cpp | 10 ++++++---- SpeedTestClient.h | 6 +++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/SpeedTest.cpp b/SpeedTest.cpp index 1a71727..4452169 100644 --- a/SpeedTest.cpp +++ b/SpeedTest.cpp @@ -186,11 +186,11 @@ double SpeedTest::execute(const ServerInfo &server, const TestConfig &config, co auto start = std::chrono::steady_clock::now(); std::vector partial_results; while (curr_size < max_size){ - long op_time = 0; + double op_time = 0; if ((spClient.*pfunc)(curr_size, config.buff_size, op_time)) { total_size += curr_size; total_time += op_time; - double metric = (curr_size * 8) / (static_cast(op_time) / 1000); + double metric = (curr_size * 8) / (op_time / 1000); partial_results.push_back(metric); if (cb) cb(true); diff --git a/SpeedTest.h b/SpeedTest.h index da7c16d..efb6ddf 100644 --- a/SpeedTest.h +++ b/SpeedTest.h @@ -22,7 +22,7 @@ #include "DataTypes.h" class SpeedTestClient; -typedef bool (SpeedTestClient::*opFn)(const long size, const long chunk_size, long &millisec); +typedef bool (SpeedTestClient::*opFn)(const long size, const long chunk_size, double &millisec); typedef void (*progressFn)(bool success); diff --git a/SpeedTestClient.cpp b/SpeedTestClient.cpp index e6fa20e..6e58016 100644 --- a/SpeedTestClient.cpp +++ b/SpeedTestClient.cpp @@ -91,7 +91,7 @@ bool SpeedTestClient::ping(double &millisec) { } // It executes DOWNLOAD command -bool SpeedTestClient::download(const long size, const long chunk_size, long &millisec) { +bool SpeedTestClient::download(const long size, const long chunk_size, double &millisec) { std::stringstream cmd; cmd << "DOWNLOAD " << size; @@ -117,13 +117,14 @@ bool SpeedTestClient::download(const long size, const long chunk_size, long &mil } auto stop = std::chrono::steady_clock::now(); - millisec = std::chrono::duration_cast(stop - start).count(); + double microsec = std::chrono::duration_cast(stop - start).count(); + millisec = microsec / 1000; delete[] buff; return true; } // It executes UPLOAD command -bool SpeedTestClient::upload(const long size, const long chunk_size, long &millisec) { +bool SpeedTestClient::upload(const long size, const long chunk_size, double &millisec) { std::stringstream cmd; cmd << "UPLOAD " << size << "\n"; auto cmd_len = cmd.str().length(); @@ -171,7 +172,8 @@ bool SpeedTestClient::upload(const long size, const long chunk_size, long &milli std::stringstream ss; ss << "OK " << size << " "; - millisec = std::chrono::duration_cast(stop - start).count(); + double microsec = std::chrono::duration_cast(stop - start).count(); + millisec = microsec / 1000; delete[] buff; return reply.substr(0, ss.str().length()) == ss.str(); diff --git a/SpeedTestClient.h b/SpeedTestClient.h index 125dee8..d91d44b 100644 --- a/SpeedTestClient.h +++ b/SpeedTestClient.h @@ -23,8 +23,8 @@ class SpeedTestClient { bool connect(); bool ping(double &millisec); - bool upload(long size, long chunk_size, long &millisec); - bool download(long size, long chunk_size, long &millisec); + bool upload(long size, long chunk_size, double &millisec); + bool download(long size, long chunk_size, double &millisec); float version(); const std::pair hostport(); void close(); @@ -39,5 +39,5 @@ class SpeedTestClient { static bool writeLine(int& fd, const std::string& buffer); }; -typedef bool (SpeedTestClient::*opFn)(const long size, const long chunk_size, long &millisec); +typedef bool (SpeedTestClient::*opFn)(const long size, const long chunk_size, double &millisec); #endif //SPEEDTEST_SPEEDTESTCLIENT_H From 5c3159e4b14e69dd1faa020a2ca24f6b29776e1f Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 13:21:29 +0800 Subject: [PATCH 07/16] Added my own personal test config --- CmdOptions.h | 4 ++- TestConfigTemplate.h | 70 ++++++++++++++++---------------------------- main.cpp | 4 +++ 3 files changed, 33 insertions(+), 45 deletions(-) diff --git a/CmdOptions.h b/CmdOptions.h index e8a1ea4..f9f9995 100644 --- a/CmdOptions.h +++ b/CmdOptions.h @@ -7,7 +7,7 @@ #include enum OutputType { verbose, text, json }; -enum LineType { automatic, slow, narrow, broad, fiber }; +enum LineType { automatic, slow, narrow, broad, fiber, gigasym }; typedef struct program_options_t { @@ -83,6 +83,8 @@ bool ParseOptions(const int argc, const char **argv, ProgramOptions& options){ options.line_type = LineType::broad; else if (strcmp(optarg, "fiber") == 0) options.line_type = LineType::fiber; + else if (strcmp(optarg, "gigasym") == 0) + options.line_type = LineType::gigasym; else { std::cerr << "Unsupported line type " << optarg << std::endl; std::cerr << "Supported line type: auto, slow, narrow, broad, fiber" < 30 && preSpeed < 150) { downloadConfig = broadbandConfigDownload; uploadConfig = broadbandConfigUpload; - } else if (preSpeed >= 150) { + } else if (preSpeed > 150 && preSpeed < 450) { downloadConfig = fiberConfigDownload; uploadConfig = fiberConfigUpload; + } else if (preSpeed >= 450) { + downloadConfig = gigaSymConfigDownload; + uploadConfig = gigaSymConfigUpload; } } diff --git a/main.cpp b/main.cpp index 8cb37bc..9680729 100644 --- a/main.cpp +++ b/main.cpp @@ -226,6 +226,10 @@ int main(const int argc, const char **argv) { uploadConfig = fiberConfigUpload; downloadConfig = fiberConfigDownload; } + else if (programOptions.line_type == LineType::gigasym) { + uploadConfig = gigaSymConfigUpload; + downloadConfig = gigaSymConfigDownload; + } if (programOptions.output_type == OutputType::verbose) std::cout << downloadConfig.label << std::endl; From 2a741b154a2efe296a58e1256d72d4b4f121ba26 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 13:50:27 +0800 Subject: [PATCH 08/16] Fix typo --- .gitignore | 2 ++ TestConfigTemplate.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 887f3c7..042c432 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,5 @@ CMakeFiles/SpeedTest.dir/DependInfo.cmake CMakeFiles/SpeedTest.dir/flags.make CMakeFiles/SpeedTest.dir/link.txt CMakeFiles/SpeedTest.dir/progress.make +CMakeFiles/Progress/1 +CMakeFiles/Progress/count.txt diff --git a/TestConfigTemplate.h b/TestConfigTemplate.h index 77046ae..fb87811 100644 --- a/TestConfigTemplate.h +++ b/TestConfigTemplate.h @@ -120,7 +120,6 @@ const TestConfig gigaSymConfigUpload = { 8, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; -}; void testConfigSelector(const double preSpeed, TestConfig& uploadConfig, TestConfig& downloadConfig){ uploadConfig = slowConfigUpload; From d568762ecc46a4e4134084059177a7ce0f3888f5 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 14:37:28 +0800 Subject: [PATCH 09/16] Change download/upload speed values to Mbps instead --- main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 9680729..6fdeb7b 100644 --- a/main.cpp +++ b/main.cpp @@ -260,7 +260,8 @@ int main(const int argc, const char **argv) { } else if (programOptions.output_type == OutputType::json) { std::cout << "\"download\":\""; std::cout << std::fixed; - std::cout << (downloadSpeed*1000*1000) << "\","; + std::cout << std::setprecision(2); + std::cout << (downloadSpeed) << "\","; } } else { std::cerr << "Download test failed." << std::endl; @@ -298,7 +299,8 @@ int main(const int argc, const char **argv) { } else if (programOptions.output_type == OutputType::json) { std::cout << "\"upload\":\""; std::cout << std::fixed; - std::cout << (uploadSpeed*1000*1000) << "\","; + std::cout << std::setprecision(2); + std::cout << (uploadSpeed) << "\","; } } else { From b02a644872e76e7b18e34d29678e73e193648354 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 14:59:44 +0800 Subject: [PATCH 10/16] Remove precision limit of download/upload JSON --- main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/main.cpp b/main.cpp index 6fdeb7b..90bdfe4 100644 --- a/main.cpp +++ b/main.cpp @@ -260,7 +260,6 @@ int main(const int argc, const char **argv) { } else if (programOptions.output_type == OutputType::json) { std::cout << "\"download\":\""; std::cout << std::fixed; - std::cout << std::setprecision(2); std::cout << (downloadSpeed) << "\","; } } else { @@ -299,7 +298,6 @@ int main(const int argc, const char **argv) { } else if (programOptions.output_type == OutputType::json) { std::cout << "\"upload\":\""; std::cout << std::fixed; - std::cout << std::setprecision(2); std::cout << (uploadSpeed) << "\","; } From 6e678760f539c0c2d49aa465c9a9a1ba07066c14 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 16:57:00 +0800 Subject: [PATCH 11/16] Reduce test time to 15s --- TestConfigTemplate.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TestConfigTemplate.h b/TestConfigTemplate.h index fb87811..c5d1a63 100644 --- a/TestConfigTemplate.h +++ b/TestConfigTemplate.h @@ -99,14 +99,14 @@ const TestConfig fiberConfigUpload = { "Fiber / Lan line type detected: profile selected fiber" }; -// The following configuration was deduced based on actual traffic monitoring in my Mikrotik router +// The following configuration was deduced based on actual traffic monitoring on my Mikrotik router const TestConfig gigaSymConfigDownload = { 5000000, // start_size 120000000, // max_size 950000, // inc_size 65536, // buff_size - 20000, // min_test_time_ms + 15000, // min_test_time_ms 8, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; @@ -116,7 +116,7 @@ const TestConfig gigaSymConfigUpload = { 70000000, // max_size 950000, // inc_size 65536, // buff_size - 20000, // min_test_time_ms + 15000, // min_test_time_ms 8, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; From 1fffbd86b03ef2bf65d72097aa6319200df55a52 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 17:38:24 +0800 Subject: [PATCH 12/16] Increase concurrency for download --- TestConfigTemplate.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestConfigTemplate.h b/TestConfigTemplate.h index c5d1a63..1f50545 100644 --- a/TestConfigTemplate.h +++ b/TestConfigTemplate.h @@ -107,7 +107,7 @@ const TestConfig gigaSymConfigDownload = { 950000, // inc_size 65536, // buff_size 15000, // min_test_time_ms - 8, // concurrency + 24, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; @@ -117,7 +117,7 @@ const TestConfig gigaSymConfigUpload = { 950000, // inc_size 65536, // buff_size 15000, // min_test_time_ms - 8, // concurrency + 8, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; From 2a11563b1b03039aac967cb18869101eb7b08f86 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Wed, 28 Apr 2021 20:08:02 +0800 Subject: [PATCH 13/16] Continue test config adjustments --- TestConfigTemplate.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestConfigTemplate.h b/TestConfigTemplate.h index 1f50545..e9a7ac8 100644 --- a/TestConfigTemplate.h +++ b/TestConfigTemplate.h @@ -107,7 +107,7 @@ const TestConfig gigaSymConfigDownload = { 950000, // inc_size 65536, // buff_size 15000, // min_test_time_ms - 24, // concurrency + 6, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; @@ -117,7 +117,7 @@ const TestConfig gigaSymConfigUpload = { 950000, // inc_size 65536, // buff_size 15000, // min_test_time_ms - 8, // concurrency + 24, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; From 83dc9d1bdc8e73567b51379c728a1298d634d2b4 Mon Sep 17 00:00:00 2001 From: JJ Macalinao Date: Thu, 29 Apr 2021 15:31:48 +0800 Subject: [PATCH 14/16] More adjustments to upload --- TestConfigTemplate.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestConfigTemplate.h b/TestConfigTemplate.h index e9a7ac8..c96518b 100644 --- a/TestConfigTemplate.h +++ b/TestConfigTemplate.h @@ -114,10 +114,10 @@ const TestConfig gigaSymConfigDownload = { const TestConfig gigaSymConfigUpload = { 5000000, // start_size 70000000, // max_size - 950000, // inc_size + 0, // inc_size 65536, // buff_size 15000, // min_test_time_ms - 24, // concurrency + 4, // concurrency "Gigabit symmetric line type detected: profile selected gigasym" }; From caa0013926f8b6f5fb8a899116e5957d496e6853 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 4 Aug 2021 21:21:46 +0800 Subject: [PATCH 15/16] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e9d0926 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 taganaka + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 09576e3af8c73b10f2bd440894214deb14ad8140 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 4 Aug 2021 21:36:28 +0800 Subject: [PATCH 16/16] Update SpeedTest.cpp --- SpeedTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SpeedTest.cpp b/SpeedTest.cpp index 4452169..4c997a7 100644 --- a/SpeedTest.cpp +++ b/SpeedTest.cpp @@ -6,6 +6,7 @@ #include #include "SpeedTest.h" #include "MD5Util.h" +#include #include SpeedTest::SpeedTest(float minServerVersion):