From b22564f2a6a6d5a235d92ff8f705ecad9d5f0d94 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 9 Dec 2014 17:49:01 +0100 Subject: httpress: provide more information regarding data rates and error counts. --- httpress.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/httpress.c b/httpress.c index 5d9bd68..26b31f8 100644 --- a/httpress.c +++ b/httpress.c @@ -95,6 +95,9 @@ static struct config config; static struct timeval last_tv; static struct timeval init_tv; static int last_rc; +static long last_bytes; +static long last_err; +struct thread_config** threads; enum nxweb_chunked_decoder_state_code {CDS_CR1=-2, CDS_LF1=-1, CDS_SIZE=0, CDS_LF2, CDS_DATA}; @@ -741,7 +744,7 @@ static int more_requests_to_run() { if (!init_tv.tv_sec) { init_tv = curr_tv; last_tv = curr_tv; - printf("#time_a time_t time_r req_t req_r req_s\n"); + printf("#time_a time_t time_r Mbps req_s err_s MB_t req_t err_t MB_r req_r err_r\n"); } if (!config.quiet && @@ -749,11 +752,35 @@ static int more_requests_to_run() { rc==config.num_requests)) { unsigned int ms_last = (curr_tv.tv_sec - last_tv.tv_sec) * 1000L + (signed long)(curr_tv.tv_usec - last_tv.tv_usec) / 1000L; unsigned int ms_init = (curr_tv.tv_sec - init_tv.tv_sec) * 1000L + (signed long)(curr_tv.tv_usec - init_tv.tv_usec) / 1000L; + thread_config* tdata; + long total_bytes=0; + long total_err=0; + int i; - printf("%10u %7u %4u %9u %6u %6u\n", + for (i=0; inum_fail; + total_bytes+=tdata->num_bytes_received+tdata->num_overhead_received; + } + + printf("%10u %7u %4u %6u %6u %5u %8u %9u %6u %7u %6u %5u\n", (unsigned int)curr_tv.tv_sec, ms_init, ms_last, - rc, rc - last_rc, (rc - last_rc) * 1000 / ms_last); + // per second + (total_bytes - last_bytes) / 125 / ms_last, + (rc - last_rc) * 1000 / ms_last, + (total_err - last_err) * 1000 / ms_last, + // total + total_bytes >> 20, + rc, + total_err, + // relative to start + (total_bytes - last_bytes) >> 20, + rc - last_rc, + total_err - last_err + ); last_rc = rc; + last_err = total_err; + last_bytes = total_bytes; last_tv = curr_tv; } asm volatile("": : :"memory"); @@ -1068,7 +1095,7 @@ int main(int argc, char* argv[]) { ); config.request_length=strlen(config.request_data); - thread_config** threads=calloc(config.num_threads, sizeof(thread_config*)); + threads=calloc(config.num_threads, sizeof(thread_config*)); if (!threads) nxweb_die("can't allocate thread pool"); ev_tstamp ts_start=ev_time(); -- 1.7.12.1