shithub: lwext4

Download patch

ref: b9ef9d3916e0f57fb92a6e9fa4945ac4b0fefd4b
parent: 31e09211a04626c08219c545a1e8885a34376750
author: gkostka <kostka.grzegorz@gmail.com>
date: Thu Oct 10 17:10:12 EDT 2013

Blockdev and bcache stats.

--- a/src/demos/generic/main.c
+++ b/src/demos/generic/main.c
@@ -142,7 +142,46 @@
 
 }
 
+static void block_stats(void)
+{
+    uint32_t i;
 
+    printf("**********************************************\n");
+    printf("ext4 blockdev stats\n");
+    printf("bdev->bread_ctr          = %d\n", bd->bread_ctr);
+    printf("bdev->bwrite_ctr         = %d\n", bd->bwrite_ctr);
+
+
+    printf("bcache->ref_blocks       = %d\n", bc->ref_blocks);
+    printf("bcache->max_ref_blocks   = %d\n", bc->max_ref_blocks);
+    printf("bcache->lru_ctr          = %d\n", bc->lru_ctr);
+
+    printf("\n");
+    for (i = 0; i < bc->cnt; ++i) {
+        printf("bcache->refctr[%d]     = %d\n", i, bc->refctr[i]);
+    }
+
+    printf("\n");
+    for (i = 0; i < bc->cnt; ++i) {
+        printf("bcache->lru_id[%d]     = %d\n", i, bc->lru_id[i]);
+    }
+
+    printf("\n");
+    for (i = 0; i < bc->cnt; ++i) {
+        printf("bcache->free_delay[%d] = %d\n", i, bc->free_delay[i]);
+    }
+
+    printf("\n");
+    for (i = 0; i < bc->cnt; ++i) {
+        printf("bcache->lba[%d]        = %d\n", i, bc->lba[i]);
+    }
+
+
+
+    printf("**********************************************\n");
+}
+
+
 int main(int argc, char **argv)
 {
 	int option_index = 0;
@@ -296,6 +335,7 @@
 	mp_stats();
 	dir_ls("/mp/");
 
+	block_stats();
 	r = ext4_umount("/mp/");
 
 	printf("Test finish: OK\n");