Schooner memslap changes
[awesomized/libmemcached] / clients / ms_stats.h
1 /*
2 * File: ms_stats.h
3 * Author: Mingqiang Zhuang
4 *
5 * Created on March 25, 2009
6 *
7 * (c) Copyright 2009, Schooner Information Technology, Inc.
8 * http://www.schoonerinfotech.com/
9 *
10 */
11 #ifndef MS_STAT_H
12 #define MS_STAT_H
13
14 #include <math.h>
15 #include <unistd.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <stdint.h>
19 #include <string.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /* statistic structure of response time */
26 typedef struct {
27 char * name;
28 uint64_t total_time;
29 uint64_t min_time;
30 uint64_t max_time;
31 uint64_t get_miss;
32 uint64_t dist[65];
33 double squares;
34 double log_product;
35
36 uint64_t period_min_time;
37 uint64_t period_max_time;
38 uint64_t pre_get_miss;
39 uint64_t pre_events;
40 uint64_t pre_total_time;
41 uint64_t pre_squares;
42 double pre_log_product;
43 } ms_stat_t;
44
45 /* initialize statistic */
46 void ms_init_stats(ms_stat_t *stat, const char *name);
47
48 /* record one event */
49 void ms_record_event(ms_stat_t *stat, uint64_t time, int get_miss);
50
51 /* dump the statistics */
52 void ms_dump_stats(ms_stat_t *stat);
53
54 /* dump the format statistics */
55 void ms_dump_format_stats(ms_stat_t *stat, int run_time,
56 int freq, int obj_size);
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif /* MS_STAT_H */