X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fbin%2Fcontrib%2Fmemaslap%2Fms_stats.h;fp=src%2Fbin%2Fcontrib%2Fmemaslap%2Fms_stats.h;h=9d12a393ede828164540c0f0661663ed8026d295;hb=77fc9c3ba95eb502d1a66146251acfcfd5606df8;hp=0000000000000000000000000000000000000000;hpb=a7e11259b99326ef0d32a1029166aa53546c2708;p=awesomized%2Flibmemcached diff --git a/src/bin/contrib/memaslap/ms_stats.h b/src/bin/contrib/memaslap/ms_stats.h new file mode 100644 index 00000000..9d12a393 --- /dev/null +++ b/src/bin/contrib/memaslap/ms_stats.h @@ -0,0 +1,66 @@ +/* + +--------------------------------------------------------------------+ + | libmemcached - 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. | + | You should have received a copy of the license in a bundled file | + | named LICENSE; in case you did not receive a copy you can review | + | 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 | + +--------------------------------------------------------------------+ +*/ + +#ifndef MS_STAT_H +#define MS_STAT_H + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* statistic structure of response time */ +typedef struct { + char *name; + uint64_t total_time; + uint64_t min_time; + uint64_t max_time; + uint64_t get_miss; + uint64_t dist[65]; + double squares; + double log_product; + + uint64_t period_min_time; + uint64_t period_max_time; + uint64_t pre_get_miss; + uint64_t pre_events; + uint64_t pre_total_time; + uint64_t pre_squares; + double pre_log_product; +} ms_stat_t; + +/* initialize statistic */ +void ms_init_stats(ms_stat_t *stat, const char *name); + +/* record one event */ +void ms_record_event(ms_stat_t *stat, uint64_t time, int get_miss); + +/* dump the statistics */ +void ms_dump_stats(ms_stat_t *stat); + +/* dump the format statistics */ +void ms_dump_format_stats(ms_stat_t *stat, int run_time, int freq, int obj_size); + +#ifdef __cplusplus +} +#endif + +#endif /* MS_STAT_H */