X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fbin%2Fmemstat.cc;h=328936a15ab358ee136fdfe4906be95634f62a48;hb=8b3a224e03457bfab11f0974114f28b2ba7a568f;hp=5208fb4da16d26d3fa4f8cd903fbb5367c6b2f60;hpb=f9c4c047caf6847f06e8059e11aff90e1ccdd84b;p=awesomized%2Flibmemcached diff --git a/src/bin/memstat.cc b/src/bin/memstat.cc index 5208fb4d..328936a1 100644 --- a/src/bin/memstat.cc +++ b/src/bin/memstat.cc @@ -1,6 +1,6 @@ /* +--------------------------------------------------------------------+ - | libmemcached - C/C++ Client Library for memcached | + | libmemcached-awesome - C/C++ Client Library for memcached | +--------------------------------------------------------------------+ | Redistribution and use in source and binary forms, with or without | | modification, are permitted under the terms of the BSD license. | @@ -9,7 +9,7 @@ | the terms online at: https://opensource.org/licenses/BSD-3-Clause | +--------------------------------------------------------------------+ | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ | - | Copyright (c) 2020 Michael Wallner | + | Copyright (c) 2020-2021 Michael Wallner https://awesome.co/ | +--------------------------------------------------------------------+ */ @@ -19,12 +19,13 @@ #define PROGRAM_DESCRIPTION "Print stats/version of or analyze a memcached cluster." #define PROGRAM_VERSION "1.1" +#define DEFAULT_LATENCY_ITERATIONS 100 // update help string, if changed + #include "common/options.hpp" #include "common/checks.hpp" -#include "common/utilities.h" +#include "common/time.hpp" #include -#include #include static memcached_return_t print_server_version(const memcached_st *, @@ -83,11 +84,6 @@ static bool analyze_stat(const client_options &opt, memcached_st *memc, memcache return true; } -using time_clock = std::chrono::high_resolution_clock; -using time_point = std::chrono::time_point; -using time_format = std::chrono::duration>; -using time_format_ms = std::chrono::duration>; - static void latency_test(uint32_t iterations, std::vector &servers) { const char *test_key = "libmemcached_test_key"; size_t test_key_len = strlen(test_key); @@ -146,7 +142,7 @@ static void latency_test(uint32_t iterations, std::vector &servers } static bool analyze_latency(client_options &opt, memcached_st *root) { - uint32_t num_of_tests = 100; + uint32_t num_of_tests = DEFAULT_LATENCY_ITERATIONS; if (auto iter_str = opt.argof("iterations")) { num_of_tests = std::stoul(iter_str);