/*
+--------------------------------------------------------------------+
- | 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. |
| 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 <mike@php.net> |
+ | Copyright (c) 2020-2021 Michael Wallner https://awesome.co/ |
+--------------------------------------------------------------------+
*/
#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 <cstdio>
-#include <chrono>
#include <iomanip>
static memcached_return_t print_server_version(const memcached_st *,
return true;
}
-using time_clock = std::chrono::high_resolution_clock;
-using time_point = std::chrono::time_point<time_clock>;
-using time_format = std::chrono::duration<double, std::ratio<1,1>>;
-using time_format_ms = std::chrono::duration<double, std::ratio<1,1000>>;
-
static void latency_test(uint32_t iterations, std::vector<memcached_st> &servers) {
const char *test_key = "libmemcached_test_key";
size_t test_key_len = strlen(test_key);
}
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);