Merge in trunk
[m6w6/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 {
28 char *name;
29 uint64_t total_time;
30 uint64_t min_time;
31 uint64_t max_time;
32 uint64_t get_miss;
33 uint64_t dist[65];
34 double squares;
35 double log_product;
36
37 uint64_t period_min_time;
38 uint64_t period_max_time;
39 uint64_t pre_get_miss;
40 uint64_t pre_events;
41 uint64_t pre_total_time;
42 uint64_t pre_squares;
43 double pre_log_product;
44 } ms_stat_t;
45
46 /* initialize statistic */
47 void ms_init_stats(ms_stat_t *stat, const char *name);
48
49
50 /* record one event */
51 void ms_record_event(ms_stat_t *stat, uint64_t time, int get_miss);
52
53
54 /* dump the statistics */
55 void ms_dump_stats(ms_stat_t *stat);
56
57
58 /* dump the format statistics */
59 void ms_dump_format_stats(ms_stat_t *stat,
60 int run_time,
61 int freq,
62 int obj_size);
63
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 #endif /* MS_STAT_H */