Received: from eggs.gnu.org ([2001:4830:134:3::10]:55473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm1ro-0001Bn-85 for qemu-devel@nongnu.org; Tue, 13 Oct 2015 11:51:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zm1rk-0005hc-83 for qemu-devel@nongnu.org; Tue, 13 Oct 2015 11:51:56 -0400 From: Alberto Garcia In-Reply-To: <20151013154233.GJ3057@stefanha-thinkpad.redhat.com> References: <84322c385b597a29ec217efd7fe99560a0bbc5d8.1443793122.git.berto@igalia.com> <20151013154233.GJ3057@stefanha-thinkpad.redhat.com> Date: Tue, 13 Oct 2015 17:51:48 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2 07/22] block: Add statistics for failed and invalid I/O operations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-block@nongnu.org, Markus Armbruster , qemu-devel@nongnu.org, Max Reitz On Tue 13 Oct 2015 05:42:33 PM CEST, Stefan Hajnoczi wrote: > On Fri, Oct 02, 2015 at 05:26:17PM +0300, Alberto Garcia wrote: >> +void block_acct_failed(BlockAcctStats *stats, BlockAcctCookie *cookie) >> +{ >> + int64_t time_ns = qemu_clock_get_ns(clock_type); >> + >> + assert(cookie->type < BLOCK_MAX_IOTYPE); >> + >> + stats->failed_ops[cookie->type]++; >> + stats->total_time_ns[cookie->type] += time_ns - cookie->start_time_ns; >> + stats->last_access_time_ns = time_ns; >> +} >> + >> +void block_acct_invalid(BlockAcctStats *stats, enum BlockAcctType type) >> +{ >> + assert(type < BLOCK_MAX_IOTYPE); >> + >> + stats->invalid_ops[type]++; >> + stats->last_access_time_ns = qemu_clock_get_ns(clock_type); >> +} > > block_acct_failed() updates total_time_ns[] but block_acct_invalid() > does not. I guess that's because block_acct_invalid() is expected to > happen during request submission and has effectively 0 duration? That's right, I put it in the commit message but I guess it's a good idea to mention it here as well. I was actually updating total_time_ns[] in block_acct_invalid() as well, but then when I was adding the block_acct_invalid() calls to the device models I realized that most/all of them happen before we even call block_acct_start(). So I decided to leave it like it is now, first because it makes the code simpler and second because as you say there would be no I/O to measure. Berto