From 9f527308d7248d1ec1d63f0911757bb5faa7ea10 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 12 Jun 2012 09:46:09 +0200 Subject: libblock: Add block device statistics --- cpukit/libblock/include/rtems/diskdevs.h | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'cpukit/libblock/include/rtems/diskdevs.h') diff --git a/cpukit/libblock/include/rtems/diskdevs.h b/cpukit/libblock/include/rtems/diskdevs.h index 6e6be5e9b7..3a9967ecb2 100644 --- a/cpukit/libblock/include/rtems/diskdevs.h +++ b/cpukit/libblock/include/rtems/diskdevs.h @@ -86,6 +86,68 @@ typedef struct { rtems_blkdev_bnum next; } rtems_blkdev_read_ahead; +/** + * @brief Block device statistics. + * + * Integer overflows in the statistic counters may happen. + */ +typedef struct { + /** + * @brief Read hit count. + * + * A read hit occurs in the rtems_bdbuf_read() function in case the block is + * in the cached or modified state. + */ + uint32_t read_hits; + + /** + * @brief Read miss count. + * + * A read miss occurs in the rtems_bdbuf_read() function in case the block is + * in the empty state and a read transfer must be initiated to read the data + * from the device. + */ + uint32_t read_misses; + + /** + * @brief Read-ahead transfer count. + * + * Each read-ahead transfer may read multiple blocks. + */ + uint32_t read_ahead_transfers; + + /** + * @brief Count of blocks transfered from the device. + */ + uint32_t read_blocks; + + /** + * @brief Read error count. + * + * Error count of transfers issued by the read or read-ahead requests. + */ + uint32_t read_errors; + + /** + * @brief Write transfer count. + * + * Each write transfer may write multiple blocks. + */ + uint32_t write_transfers; + + /** + * @brief Count of blocks transfered to the device. + */ + uint32_t write_blocks; + + /** + * @brief Write error count. + * + * Error count of transfers issued by write requests. + */ + uint32_t write_errors; +} rtems_blkdev_stats; + /** * @brief Description of a disk device (logical and physical disks). * @@ -201,6 +263,11 @@ struct rtems_disk_device { */ bool deleted; + /** + * @brief Device statistics for this disk. + */ + rtems_blkdev_stats stats; + /** * @brief Read-ahead control for this disk. */ -- cgit v1.2.3