-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstats.h
71 lines (59 loc) · 1.25 KB
/
stats.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// stats.h
//
// Author: David Meisner ([email protected])
//
#ifndef STATS_H
#define STATS_H
#include "loader.h"
#include "config.h"
#include <math.h>
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
//#define N_HISTOGRAM_BINS 10000
//#define MIN_HISTOGRAM_VALUE 10e-6
//#define MAX_HISTOGRAM_VALUE 10
struct config;
struct timeval start_time;
//A single statistic
struct stat {
double s0;
double s1;
double s2;
double min;
double max;
int fulls[1000];
int thousands[1000];
int millis[50010];
int micros[10000];
};
struct memcached_stats {
int requests;
int ops;
int gets;
int multigets;
int sets;
int hits;
int misses;
int multi_gets;
int incrs;
int adds;
int replaces;
int deletes;
struct stat response_time;
struct stat get_size;
struct timeval last_time;
};
extern pthread_mutex_t stats_lock;
//For now, all statistics are handled by this global struct
struct memcached_stats global_stats;
double findQuantile(struct stat* stat, double quantile);
void printGlobalStats();
void checkExit(struct config* config);
void addSample(struct stat* stat, float sample);
double getAvg(struct stat* stat);
double getStdDev(struct stat* stat);
void statsLoop(struct config* config);
#endif