From dffa759f71f647f449d965a71dbe733c2deb0e3e Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Tue, 24 Mar 2020 20:53:25 -0700 Subject: [PATCH] move IXBench code under ixwebsocker folder --- CMakeLists.txt | 2 ++ {ws => ixwebsocket}/IXBench.cpp | 8 ++++---- {ws => ixwebsocket}/IXBench.h | 2 +- ws/CMakeLists.txt | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) rename {ws => ixwebsocket}/IXBench.cpp (75%) rename {ws => ixwebsocket}/IXBench.h (86%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5902246a..ba8de2bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") endif() set( IXWEBSOCKET_SOURCES + ixwebsocket/IXBench.cpp ixwebsocket/IXCancellationRequest.cpp ixwebsocket/IXConnectionState.cpp ixwebsocket/IXDNSLookup.cpp @@ -53,6 +54,7 @@ set( IXWEBSOCKET_SOURCES ) set( IXWEBSOCKET_HEADERS + ixwebsocket/IXBench.h ixwebsocket/IXCancellationRequest.h ixwebsocket/IXConnectionState.h ixwebsocket/IXDNSLookup.h diff --git a/ws/IXBench.cpp b/ixwebsocket/IXBench.cpp similarity index 75% rename from ws/IXBench.cpp rename to ixwebsocket/IXBench.cpp index a0c63c45..64ca2eaf 100644 --- a/ws/IXBench.cpp +++ b/ixwebsocket/IXBench.cpp @@ -6,13 +6,13 @@ #include "IXBench.h" -#include +#include namespace ix { Bench::Bench(const std::string& description) : _description(description) - , _start(std::chrono::system_clock::now()) + , _start(std::chrono::high_resolution_clock::now()) , _reported(false) { ; @@ -28,11 +28,11 @@ namespace ix void Bench::report() { - auto now = std::chrono::system_clock::now(); + auto now = std::chrono::high_resolution_clock::now(); auto milliseconds = std::chrono::duration_cast(now - _start); _ms = milliseconds.count(); - spdlog::info("{} completed in {} ms", _description, _ms); + std::cerr << _description << " completed in " << _ms << "ms" << std::endl; _reported = true; } diff --git a/ws/IXBench.h b/ixwebsocket/IXBench.h similarity index 86% rename from ws/IXBench.h rename to ixwebsocket/IXBench.h index e21afac5..5b3d3eb7 100644 --- a/ws/IXBench.h +++ b/ixwebsocket/IXBench.h @@ -21,7 +21,7 @@ namespace ix private: std::string _description; - std::chrono::time_point _start; + std::chrono::time_point _start; uint64_t _ms; bool _reported; }; diff --git a/ws/CMakeLists.txt b/ws/CMakeLists.txt index bdba3980..0e5e422f 100644 --- a/ws/CMakeLists.txt +++ b/ws/CMakeLists.txt @@ -35,7 +35,6 @@ endif() add_executable(ws ../third_party/msgpack11/msgpack11.cpp ${JSONCPP_SOURCES} - IXBench.cpp ws_http_client.cpp ws_ping_pong.cpp