Skip to content

Commit

Permalink
version 1.20.3
Browse files Browse the repository at this point in the history
fixes the example program to not
display science notations on bursts

Signed-off-by: Oskari Rauta <[email protected]>
  • Loading branch information
oskarirauta committed Oct 31, 2023
1 parent da74df0 commit ab94593
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,13 @@ int main(const int argc, const char **argv) {

double downloadSpeed = 0;

if ( sp.download_speed(server, profile.download, downloadSpeed, [&programOptions, &profile, &output_mutex](bool success, long current_speed) {
if ( sp.download_speed(server, profile.download, downloadSpeed, [&programOptions, &profile, &output_mutex](bool success, double current_speed) {

if ( programOptions.output_type == OutputType::verbose && success ) {
output_mutex.lock();
std::cout << "\rTesting download speed (" <<
profile.download.concurrency << "): " <<
std::fixed << std::showpoint <<
std::setprecision(2) <<
(double)(current_speed / 1000 / 1000 * profile.download.concurrency ) <<
" Mbit/s" << " " << std::flush;
Expand All @@ -301,15 +302,15 @@ int main(const int argc, const char **argv) {

if ( programOptions.output_type == OutputType::verbose )
std::cout << "\rDownload: " <<
std::fixed << std::setprecision(2) << downloadSpeed <<
std::fixed << std::setprecision(2) << std::showpoint << downloadSpeed <<
" Mbit/s" << " " << std::endl;
else if ( programOptions.output_type == OutputType::text )
std::cout << "DOWNLOAD_SPEED=" <<
std::fixed << std::setprecision(2) <<
std::fixed << std::showpoint << std::setprecision(2) <<
downloadSpeed << std::endl;
else if ( programOptions.output_type == OutputType::json )
std::cout << "\"download\":" <<
std::fixed << std::setprecision(2) <<
std::fixed << std::showpoint << std::setprecision(2) <<
( downloadSpeed * 1000 * 1000 ) << ",\"download_mbit\":" <<
std::fixed << std::setprecision(2) << downloadSpeed << ",";

Expand Down Expand Up @@ -344,6 +345,7 @@ int main(const int argc, const char **argv) {
output_mutex.lock();
std::cout << "\rTesting upload speed (" <<
profile.upload.concurrency << "): " <<
std::fixed << std::showpoint <<
std::setprecision(2) <<
(double)(current_speed / 1000 / 1000 * profile.download.concurrency ) <<
" Mbit/s" << " " << std::flush;
Expand All @@ -354,15 +356,15 @@ int main(const int argc, const char **argv) {

if ( programOptions.output_type == OutputType::verbose )
std::cout << "\rUpload: " <<
std::fixed << std::setprecision(2) << uploadSpeed <<
std::fixed << std::showpoint << std::setprecision(2) << uploadSpeed <<
" Mbit/s" << " " << std::endl;
else if ( programOptions.output_type == OutputType::text )
std::cout << "UPLOAD_SPEED=" <<
std::fixed << std::setprecision(2) << uploadSpeed << std::endl;
std::fixed << std::showpoint << std::setprecision(2) << uploadSpeed << std::endl;
else if ( programOptions.output_type == OutputType::json )
std::cout << "\"upload\":" << std::fixed << std::setprecision(2) <<
( uploadSpeed * 1000 * 1000 ) << ",\"upload_mbit\":" <<
std::fixed << std::setprecision(2) << uploadSpeed << ",";
std::fixed << std::showpoint << std::setprecision(2) << uploadSpeed << ",";

} else {

Expand Down
2 changes: 1 addition & 1 deletion include/speedtest/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace speedtest {

static const std::string version = "1.20.2";
static const std::string version = "1.20.3";
static const std::string git_commit =
#ifdef SPEEDTEST_GIT_COMMIT
SPEEDTEST_GIT_COMMIT;
Expand Down

4 comments on commit ab94593

@vlw
Copy link

@vlw vlw commented on ab94593 Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# make
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/sp_md5.o src/md5.cpp;
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/sp_xml.o src/xml.cpp;
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/sp_client.o src/client.cpp;
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/sp_parser.o src/parser.cpp;
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/sp_profile.o src/profile.cpp;
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/sp_speedtest.o src/speedtest.cpp;
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/sp_json_servers_parser.o src/json_servers_parser.cpp;
ar rcs libspeedtestcpp.a objs/sp_md5.o objs/sp_xml.o objs/sp_client.o objs/sp_parser.o objs/sp_profile.o objs/sp_speedtest.o objs/sp_json_servers_parser.o
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -L/lib -L/usr/lib -shared -lcurl objs/sp_md5.o objs/sp_xml.o objs/sp_client.o objs/sp_parser.o objs/sp_profile.o objs/sp_speedtest.o objs/sp_json_servers_parser.o -o libspeedtestcpp.so.1.0.0;
ln -s libspeedtestcpp.so.1.0.0 ./libspeedtestcpp.so
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -I./examples/include -I././include -c -o objs/main.o examples/main.cpp;
g++ --std=c++23 -Wall -fPIC -DSPEEDTEST_GIT_COMMIT="\"ab945938\"" -L/lib -L/usr/lib -L. -lcurl -lspeedtestcpp objs/main.o -o speedtest;
/usr/bin/ld: objs/main.o: in function `main':
main.cpp:(.text+0xac8): undefined reference to `speedtest::SpeedTest::SpeedTest(bool, float)'
/usr/bin/ld: main.cpp:(.text+0xaf0): undefined reference to `speedtest::SpeedTest::set_insecure(bool)'
/usr/bin/ld: main.cpp:(.text+0xafc): undefined reference to `speedtest::SpeedTest::ipinfo(speedtest::IPInfo&)'
/usr/bin/ld: main.cpp:(.text+0xe74): undefined reference to `speedtest::SpeedTest::servers()'
/usr/bin/ld: main.cpp:(.text+0x1594): undefined reference to `speedtest::SpeedTest::select_recommended_server(speedtest::Server&)'
/usr/bin/ld: main.cpp:(.text+0x16f0): undefined reference to `speedtest::SpeedTest::best_server(int, std::function<void (bool, speedtest::Server const&, long)>)'
/usr/bin/ld: main.cpp:(.text+0x1754): undefined reference to `speedtest::SpeedTest::set_server(speedtest::Server&, std::vector<speedtest::Server, std::allocator<speedtest::Server> >&)'
/usr/bin/ld: main.cpp:(.text+0x1850): undefined reference to `speedtest::SpeedTest::latency()'
/usr/bin/ld: main.cpp:(.text+0x1a94): undefined reference to `speedtest::SpeedTest::latency()'
/usr/bin/ld: main.cpp:(.text+0x1b7c): undefined reference to `speedtest::SpeedTest::latency()'
/usr/bin/ld: main.cpp:(.text+0x1be4): undefined reference to `speedtest::SpeedTest::latency()'
/usr/bin/ld: main.cpp:(.text+0x1c4c): undefined reference to `speedtest::SpeedTest::latency()'
/usr/bin/ld: main.cpp:(.text+0x1cbc): undefined reference to `speedtest::SpeedTest::jitter(speedtest::Server const&, long&, int)'
/usr/bin/ld: main.cpp:(.text+0x1e60): undefined reference to `speedtest::Profile::Profile(double)'
/usr/bin/ld: main.cpp:(.text+0x1e6c): undefined reference to `speedtest::SpeedTest::profile(speedtest::Profile&)'
/usr/bin/ld: main.cpp:(.text+0x1ea8): undefined reference to `speedtest::Config::preflight'
/usr/bin/ld: main.cpp:(.text+0x1eac): undefined reference to `speedtest::Config::preflight'
/usr/bin/ld: main.cpp:(.text+0x1f18): undefined reference to `speedtest::Config::preflight'
/usr/bin/ld: main.cpp:(.text+0x1f1c): undefined reference to `speedtest::Config::preflight'
/usr/bin/ld: main.cpp:(.text+0x1f24): undefined reference to `speedtest::SpeedTest::download_speed(speedtest::Server const&, speedtest::Config const&, double&, std::function<void (bool, double)>)'
/usr/bin/ld: main.cpp:(.text+0x1fb4): undefined reference to `speedtest::Profile::Profile(double)'
/usr/bin/ld: main.cpp:(.text+0x211c): undefined reference to `speedtest::SpeedTest::download_speed(speedtest::Server const&, speedtest::Config const&, double&, std::function<void (bool, double)>)'
/usr/bin/ld: main.cpp:(.text+0x24c8): undefined reference to `speedtest::SpeedTest::upload_speed(speedtest::Server const&, speedtest::Config const&, double&, std::function<void (bool, double)>)'
/usr/bin/ld: main.cpp:(.text+0x27b0): undefined reference to `speedtest::SpeedTest::share(speedtest::Server const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
/usr/bin/ld: main.cpp:(.text+0x2954): undefined reference to `speedtest::SpeedTest::~SpeedTest()'
/usr/bin/ld: main.cpp:(.text+0x2a1c): undefined reference to `speedtest::SpeedTest::~SpeedTest()'
collect2: error: ld returned 1 exit status
make: *** [Makefile:38: speedtest] Error 1

can't build on aarch64 linux @oskarirauta

@oskarirauta
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting.. I wonder why.. Does aarch64 support float type?

@vlw
Copy link

@vlw vlw commented on ab94593 Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does aarch64 support float type?

@oskarirauta
yes. looks like it's makefile issue... can you fix it?

@oskarirauta
Copy link
Owner Author

@oskarirauta oskarirauta commented on ab94593 Apr 17, 2024 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.