diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-14 10:45:36 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-03-14 11:27:14 +0100 |
commit | 941d470db4835c96b2ee7039c4ca17ba6fec52a4 (patch) | |
tree | 9e02f2820ac53784e81f42ce8dbfee5c3ad7c30c /cpukit | |
parent | PR2040: libblock: Flash disk documentation (diff) | |
download | rtems-941d470db4835c96b2ee7039c4ca17ba6fec52a4.tar.bz2 |
PR2040: libblock: Flash disk starvations statistic
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libblock/src/flashdisk.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cpukit/libblock/src/flashdisk.c b/cpukit/libblock/src/flashdisk.c index 107f8b45bc..254528e045 100644 --- a/cpukit/libblock/src/flashdisk.c +++ b/cpukit/libblock/src/flashdisk.c @@ -196,6 +196,8 @@ typedef struct rtems_flashdisk uint8_t* copy_buffer; /**< Copy buf used during compacting */ uint32_t info_level; /**< The info trace level. */ + + uint32_t starvations; /**< Erased blocks starvations counter. */ } rtems_flashdisk; /** @@ -276,9 +278,14 @@ rtems_fdisk_printf (const rtems_flashdisk* fd, const char *format, ...) } static bool -rtems_fdisk_is_erased_blocks_starvation (const rtems_flashdisk* fd) +rtems_fdisk_is_erased_blocks_starvation (rtems_flashdisk* fd) { - return fd->erased_blocks < fd->unavail_blocks; + bool starvation = fd->erased_blocks < fd->unavail_blocks; + + if (starvation) + fd->starvations++; + + return starvation; } /** @@ -2218,6 +2225,7 @@ rtems_fdisk_print_status (rtems_flashdisk* fd) rtems_fdisk_printf (fd, "Block count\t%d", fd->block_count); rtems_fdisk_printf (fd, "Unavail blocks\t%d", fd->unavail_blocks); + rtems_fdisk_printf (fd, "Starvations\t%d", fd->starvations); count = rtems_fdisk_segment_count_queue (&fd->available); total = count; rtems_fdisk_printf (fd, "Available queue\t%ld (%ld)", |