Mercurial
comparison third_party/wrk/src/wrk.h @ 178:94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Thu, 22 Jan 2026 20:10:30 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 177:24fe8ff94056 | 178:94705b5986b3 |
|---|---|
| 1 #ifndef WRK_H | |
| 2 #define WRK_H | |
| 3 | |
| 4 #include "config.h" | |
| 5 #include <pthread.h> | |
| 6 #include <inttypes.h> | |
| 7 #include <sys/types.h> | |
| 8 #include <netdb.h> | |
| 9 #include <sys/socket.h> | |
| 10 | |
| 11 #include <openssl/ssl.h> | |
| 12 #include <openssl/err.h> | |
| 13 #include <lua.h> | |
| 14 | |
| 15 #include "stats.h" | |
| 16 #include "ae.h" | |
| 17 #include "http_parser.h" | |
| 18 | |
| 19 #define RECVBUF 8192 | |
| 20 | |
| 21 #define MAX_THREAD_RATE_S 10000000 | |
| 22 #define SOCKET_TIMEOUT_MS 2000 | |
| 23 #define RECORD_INTERVAL_MS 100 | |
| 24 | |
| 25 extern const char *VERSION; | |
| 26 | |
| 27 typedef struct { | |
| 28 pthread_t thread; | |
| 29 aeEventLoop *loop; | |
| 30 struct addrinfo *addr; | |
| 31 uint64_t connections; | |
| 32 uint64_t complete; | |
| 33 uint64_t requests; | |
| 34 uint64_t bytes; | |
| 35 uint64_t start; | |
| 36 lua_State *L; | |
| 37 errors errors; | |
| 38 struct connection *cs; | |
| 39 } thread; | |
| 40 | |
| 41 typedef struct { | |
| 42 char *buffer; | |
| 43 size_t length; | |
| 44 char *cursor; | |
| 45 } buffer; | |
| 46 | |
| 47 typedef struct connection { | |
| 48 thread *thread; | |
| 49 http_parser parser; | |
| 50 enum { | |
| 51 FIELD, VALUE | |
| 52 } state; | |
| 53 int fd; | |
| 54 SSL *ssl; | |
| 55 bool delayed; | |
| 56 uint64_t start; | |
| 57 char *request; | |
| 58 size_t length; | |
| 59 size_t written; | |
| 60 uint64_t pending; | |
| 61 buffer headers; | |
| 62 buffer body; | |
| 63 char buf[RECVBUF]; | |
| 64 } connection; | |
| 65 | |
| 66 #endif /* WRK_H */ |