comparison third_party/wrk/src/stats.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 STATS_H
2 #define STATS_H
3
4 #include <stdbool.h>
5 #include <stdint.h>
6
7 #define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
8 #define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
9
10 typedef struct {
11 uint32_t connect;
12 uint32_t read;
13 uint32_t write;
14 uint32_t status;
15 uint32_t timeout;
16 } errors;
17
18 typedef struct {
19 uint64_t count;
20 uint64_t limit;
21 uint64_t min;
22 uint64_t max;
23 uint64_t data[];
24 } stats;
25
26 stats *stats_alloc(uint64_t);
27 void stats_free(stats *);
28
29 int stats_record(stats *, uint64_t);
30 void stats_correct(stats *, int64_t);
31
32 long double stats_mean(stats *);
33 long double stats_stdev(stats *stats, long double);
34 long double stats_within_stdev(stats *, long double, long double, uint64_t);
35 uint64_t stats_percentile(stats *, long double);
36
37 uint64_t stats_popcount(stats *);
38 uint64_t stats_value_at(stats *stats, uint64_t, uint64_t *);
39
40 #endif /* STATS_H */