block: Extract the BlockAcctStats structure

Extract the block accounting statistics into a structure so the block device
models can hold them in the future.

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
block: Extract the block accounting code

The plan is to add new accounting metrics (latency, invalid requests, failed
requests, queue depth) and block.c is overpopulated so it will be better to work
in a separate module.

Moreover the long term plan is to have statistics in each of the BDS of the graph
for metrology purpose; this means that the device model statistics must move from
the topmost BDS to the device model.

So we need to decouple the statistic code from BlockDriverState.

This is another argument for the extraction of the code in a separate module.

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
block: rename BlockAcctType members to start with BLOCK_ instead of BDRV_

The middle term goal is to move the BlockAcctStats structure in the device models.
(Capturing I/O accounting statistics in the device models is good for billing)
This patch make a small step in this direction by removing a reference to BDRV.

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
block: Make the block accounting functions operate on BlockAcctStats

This is the next step for decoupling block accounting functions from
BlockDriverState.
In a future commit the BlockAcctStats structure will be moved from
BlockDriverState to the device models structures.

Note that bdrv_get_stats was introduced so device models can retrieve the
BlockAcctStats structure of a BlockDriverState without being aware of it's
layout.
This function should go away when BlockAcctStats will be embedded in the device
models structures.

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
timers: Move NANOSECONDS_PER_SECONDS to timer.h for future reuse

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
util: Add an utility infrastructure used to compute an average on a time slice

The algorithm used was defined on the list while discussing the new IO accounting
overhaul.
See http://lists.nongnu.org/archive/html/qemu-devel/2014-08/msg04954.html

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>