forked from aarond10/https_dns_proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstat.h
More file actions
37 lines (26 loc) · 778 Bytes
/
stat.h
File metadata and controls
37 lines (26 loc) · 778 Bytes
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
#ifndef _STAT_H_
#define _STAT_H_
#include <stdint.h>
#include <ev.h>
typedef struct {
struct ev_loop *loop;
int stats_interval;
size_t requests_size;
size_t responses_size;
uint64_t requests;
uint64_t responses;
uint64_t query_times_sum;
uint64_t connections_opened;
uint64_t connections_closed;
uint64_t connections_reused;
ev_timer stats_timer;
} stat_t;
void stat_init(stat_t *s, struct ev_loop *loop, int stats_interval);
void stat_request_begin(stat_t *s, size_t req_len);
void stat_request_end(stat_t *s, size_t resp_len, ev_tstamp latency);
void stat_connection_opened(stat_t *s);
void stat_connection_closed(stat_t *s);
void stat_connection_reused(stat_t *s);
void stat_stop(stat_t *s);
void stat_cleanup(stat_t *s);
#endif // _STAT_H_