forked from wg/wrk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrk.h
66 lines (56 loc) · 1.14 KB
/
wrk.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
#ifndef WRK_H
#define WRK_H
#include "config.h"
#include <pthread.h>
#include <inttypes.h>
#include <sys/types.h>
#include <netdb.h>
#include <sys/socket.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <luajit-2.0/lua.h>
#include "stats.h"
#include "ae.h"
#include "http_parser.h"
#define RECVBUF 8192
#define MAX_THREAD_RATE_S 10000000
#define SOCKET_TIMEOUT_MS 2000
#define RECORD_INTERVAL_MS 100
extern const char *VERSION;
typedef struct {
pthread_t thread;
aeEventLoop *loop;
struct addrinfo *addr;
uint64_t connections;
uint64_t complete;
uint64_t requests;
uint64_t bytes;
uint64_t start;
lua_State *L;
errors errors;
struct connection *cs;
} thread;
typedef struct {
char *buffer;
size_t length;
char *cursor;
} buffer;
typedef struct connection {
thread *thread;
http_parser parser;
enum {
FIELD, VALUE
} state;
int fd;
SSL *ssl;
bool delayed;
uint64_t start;
char *request;
size_t length;
size_t written;
uint64_t pending;
buffer headers;
buffer body;
char buf[RECVBUF];
} connection;
#endif /* WRK_H */