From: Jens Axboe Date: Mon, 30 Jan 2006 13:36:25 +0000 (+0100) Subject: [PATCH] blktrace: allow live tracing to get full subbuffers as well X-Git-Tag: blktrace-0.99.1~95 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b4aabcb3cdf273988273667dcd7d7e42c81f1641;p=blktrace.git [PATCH] blktrace: allow live tracing to get full subbuffers as well The poll() timeout will keep us reading smaller buffers, if the data generation rate isn't high enough. --- diff --git a/blktrace.c b/blktrace.c index 8b6c93c..337f142 100644 --- a/blktrace.c +++ b/blktrace.c @@ -285,7 +285,7 @@ static void wait_for_data(struct thread_information *tip) struct pollfd pfd = { .fd = tip->fd, .events = POLLIN }; do { - poll(&pfd, 1, 10); + poll(&pfd, 1, 100); if (pfd.revents & POLLIN) break; if (tip->ofile_stdout) @@ -332,21 +332,13 @@ static inline void tip_fd_lock(struct thread_information *tip) static int get_subbuf(struct thread_information *tip) { struct tip_subbuf *ts; - int ts_size, ret; - - /* - * live tracing should get a lower count to make it more "realtime" - */ - if (tip->ofile_stdout) - ts_size = 1024; - else - ts_size = buf_size; + int ret; ts = malloc(sizeof(*ts)); - ts->buf = malloc(ts_size); - ts->max_len = ts_size; + ts->buf = malloc(buf_size); + ts->max_len = buf_size; - ret = read_data(tip, ts->buf, ts_size); + ret = read_data(tip, ts->buf, ts->max_len); if (ret > 0) { ts->len = ret; tip_fd_lock(tip);