Mercurial
annotate third_party/wrk/src/main.h @ 179:8d17f6e6e290
[ThirdParty] Added emsdk bazel rules that can be supported by bazel 9.0.0
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Thu, 22 Jan 2026 21:23:17 -0800 |
| parents | 94705b5986b3 |
| children |
| rev | line source |
|---|---|
|
178
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
1 #ifndef MAIN_H |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
2 #define MAIN_H |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
3 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
4 #include <ctype.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
5 #include <errno.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
6 #include <fcntl.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
7 #include <getopt.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
8 #include <math.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
9 #include <netinet/in.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
10 #include <netinet/tcp.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
11 #include <stdarg.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
12 #include <stdbool.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
13 #include <stdio.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
14 #include <stdlib.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
15 #include <string.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
16 #include <signal.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
17 #include <time.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
18 #include <unistd.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
19 #include <sys/time.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
20 #include <sys/uio.h> |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
21 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
22 #include "ssl.h" |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
23 #include "aprintf.h" |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
24 #include "stats.h" |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
25 #include "units.h" |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
26 #include "zmalloc.h" |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
27 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
28 struct config; |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
29 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
30 static void *thread_main(void *); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
31 static int connect_socket(thread *, connection *); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
32 static int reconnect_socket(thread *, connection *); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
33 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
34 static int record_rate(aeEventLoop *, long long, void *); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
35 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
36 static void socket_connected(aeEventLoop *, int, void *, int); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
37 static void socket_writeable(aeEventLoop *, int, void *, int); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
38 static void socket_readable(aeEventLoop *, int, void *, int); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
39 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
40 static int response_complete(http_parser *); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
41 static int header_field(http_parser *, const char *, size_t); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
42 static int header_value(http_parser *, const char *, size_t); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
43 static int response_body(http_parser *, const char *, size_t); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
44 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
45 static uint64_t time_us(); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
46 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
47 static int parse_args(struct config *, char **, struct http_parser_url *, char **, int, char **); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
48 static char *copy_url_part(char *, struct http_parser_url *, enum http_parser_url_fields); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
49 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
50 static void print_stats_header(); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
51 static void print_stats(char *, stats *, char *(*)(long double)); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
52 static void print_stats_latency(stats *); |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
53 |
|
94705b5986b3
[ThirdParty] Added WRK and luajit for load testing.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
54 #endif /* MAIN_H */ |