From: Jens Axboe Date: Tue, 14 Feb 2006 13:52:28 +0000 (+0100) Subject: [PATCH] blktrace: various net related fixes (accounting, stats, etc) X-Git-Tag: blktrace-0.99.1~47 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=410d7c623c962833282bc97d5fc140b7539788b4;p=blktrace.git [PATCH] blktrace: various net related fixes (accounting, stats, etc) --- diff --git a/blktrace.c b/blktrace.c index f34588f..5936540 100644 --- a/blktrace.c +++ b/blktrace.c @@ -41,7 +41,6 @@ #include #include #include -#include #include "blktrace.h" #include "barrier.h" @@ -426,15 +425,22 @@ static int read_data_net(struct thread_information *tip, void *buf, int len) } } while (!is_done() && bytes_left); - return len; + return len - bytes_left; } static int read_data(struct thread_information *tip, void *buf, int len) { + int ret; + if (net_mode == Net_server) - return read_data_net(tip, buf, len); + ret = read_data_net(tip, buf, len); + else + ret = read_data_file(tip, buf, len); + + if (ret > 0) + tip->data_read += ret; - return read_data_file(tip, buf, len); + return ret; } static inline struct tip_subbuf * @@ -509,7 +515,6 @@ static int mmap_subbuf(struct thread_information *tip, unsigned int maxlen) ret = read_data(tip, tip->fs_buf + tip->fs_off, maxlen); if (ret >= 0) { - tip->data_read += ret; tip->fs_size += ret; tip->fs_off += ret; return 0; @@ -1060,6 +1065,7 @@ static struct device_information *net_get_dip(char *buts_name) device_information = realloc(device_information, (ndevs + 1) * sizeof(*dip)); dip = &device_information[ndevs]; strcpy(dip->buts_name, buts_name); + strcpy(dip->path, buts_name); ndevs++; dip->threads = malloc(ncpus * sizeof(struct thread_information)); memset(dip->threads, 0, ncpus * sizeof(struct thread_information)); @@ -1219,6 +1225,7 @@ static int net_server(void) tip_ftrunc_final(&dip->threads[j]); } + show_stats(); return 0; }