1
0
mirror of https://github.com/wg/wrk synced 2025-01-08 06:52:55 +08:00

cleanup & pipelining for 3.1.0 release

This commit is contained in:
Will 2014-02-10 19:35:13 +09:00
parent 4facab702e
commit 5b2fa06151
2 changed files with 23 additions and 23 deletions

View File

@ -331,6 +331,26 @@ static int calibrate(aeEventLoop *loop, long long id, void *data) {
return AE_NOMORE;
}
static int check_timeouts(aeEventLoop *loop, long long id, void *data) {
thread *thread = data;
connection *c = thread->cs;
uint64_t now = time_us();
uint64_t maxAge = now - (cfg.timeout * 1000);
for (uint64_t i = 0; i < thread->connections; i++, c++) {
if (maxAge > c->start) {
thread->errors.timeout++;
}
}
if (stop || now >= thread->stop_at) {
aeStop(loop);
}
return TIMEOUT_INTERVAL_MS;
}
static int sample_rate(aeEventLoop *loop, long long id, void *data) {
thread *thread = data;
@ -418,26 +438,6 @@ static int response_complete(http_parser *parser) {
return 0;
}
static int check_timeouts(aeEventLoop *loop, long long id, void *data) {
thread *thread = data;
connection *c = thread->cs;
uint64_t now = time_us();
uint64_t maxAge = now - (cfg.timeout * 1000);
for (uint64_t i = 0; i < thread->connections; i++, c++) {
if (maxAge > c->start) {
thread->errors.timeout++;
}
}
if (stop || now >= thread->stop_at) {
aeStop(loop);
}
return TIMEOUT_INTERVAL_MS;
}
static void socket_connected(aeEventLoop *loop, int fd, void *data, int mask) {
connection *c = data;
@ -450,8 +450,8 @@ static void socket_connected(aeEventLoop *loop, int fd, void *data, int mask) {
http_parser_init(&c->parser, HTTP_RESPONSE);
c->written = 0;
aeCreateFileEvent(c->thread->loop, c->fd, AE_READABLE, socket_readable, c);
aeCreateFileEvent(c->thread->loop, c->fd, AE_WRITABLE, socket_writeable, c);
aeCreateFileEvent(c->thread->loop, fd, AE_READABLE, socket_readable, c);
aeCreateFileEvent(c->thread->loop, fd, AE_WRITABLE, socket_writeable, c);
return;

View File

@ -14,7 +14,7 @@
#include "script.h"
#include "http_parser.h"
#define VERSION "3.0.3"
#define VERSION "3.1.0"
#define RECVBUF 8192
#define SAMPLES 100000000