1
0
mirror of https://github.com/wg/wrk synced 2025-02-13 22:53:06 +08:00

increase rate calculation precision

This commit is contained in:
Will 2013-06-26 16:19:16 +09:00
parent 256b4756d3
commit 615b548729
2 changed files with 3 additions and 3 deletions

View File

@ -289,7 +289,7 @@ static int calibrate(aeEventLoop *loop, long long id, void *data) {
thread *thread = data; thread *thread = data;
uint64_t elapsed_ms = (time_us() - thread->start) / 1000; uint64_t elapsed_ms = (time_us() - thread->start) / 1000;
uint64_t req_per_ms = thread->requests / elapsed_ms; uint64_t req_per_ms = ceil(thread->requests / (double) elapsed_ms);
if (!req_per_ms) return CALIBRATE_DELAY_MS / 2; if (!req_per_ms) return CALIBRATE_DELAY_MS / 2;
@ -307,7 +307,7 @@ static int sample_rate(aeEventLoop *loop, long long id, void *data) {
thread *thread = data; thread *thread = data;
uint64_t elapsed_ms = (time_us() - thread->start) / 1000; uint64_t elapsed_ms = (time_us() - thread->start) / 1000;
uint64_t requests = (thread->requests / elapsed_ms) * 1000; uint64_t requests = (thread->requests / (double) elapsed_ms) * 1000;
uint64_t missed = thread->rate - MIN(thread->rate, thread->latency->limit); uint64_t missed = thread->rate - MIN(thread->rate, thread->latency->limit);
uint64_t count = thread->rate - missed; uint64_t count = thread->rate - missed;

View File

@ -13,7 +13,7 @@
#include "ae.h" #include "ae.h"
#include "http_parser.h" #include "http_parser.h"
#define VERSION "2.2.0" #define VERSION "2.2.1"
#define RECVBUF 8192 #define RECVBUF 8192
#define SAMPLES 100000000 #define SAMPLES 100000000