Skip to content

Commit

Permalink
cleanup & pipelining for 3.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
wg committed Feb 10, 2014
1 parent 4facab7 commit 5b2fa06
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
44 changes: 22 additions & 22 deletions src/wrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/wrk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5b2fa06

Please sign in to comment.