From: Charles Manning Date: Thu, 19 Mar 2020 02:14:30 +0000 (+1300) Subject: Add stats to flash simulator X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=86e9358ed3c3292d54b41fa6f32859cce64abcf0 Add stats to flash simulator Signed-off-by: Charles Manning --- diff --git a/rtems/rtems-y-test/basic-test/README b/rtems/rtems-y-test/basic-test/README new file mode 100644 index 0000000..83403b6 --- /dev/null +++ b/rtems/rtems-y-test/basic-test/README @@ -0,0 +1,4 @@ +The basic tests test common fs operations such as open, close, read, write etc. + +Multiple files and directories are opened, created, read, deleted, truncated etc. + diff --git a/rtems/rtems-y-test/common/yaffs-rtems-flashsim.c b/rtems/rtems-y-test/common/yaffs-rtems-flashsim.c index b6c83f2..aafa5c0 100644 --- a/rtems/rtems-y-test/common/yaffs-rtems-flashsim.c +++ b/rtems/rtems-y-test/common/yaffs-rtems-flashsim.c @@ -22,6 +22,12 @@ #define dout(...) do { } while(0) #endif + + +uint32_t stats_reads; +uint32_t stats_writes; +uint32_t stats_erases; + typedef struct { unsigned char page[PAGES_PER_BLOCK][PAGE_SIZE]; unsigned blockOk; @@ -95,6 +101,8 @@ static int yramsim_rd_chunk (struct yaffs_dev *dev, int pageId, unsigned char * d; unsigned char *s; + stats_reads++; + if(blockId >= sim->nBlocks || pageOffset >= PAGES_PER_BLOCK || dataLength >DATA_SIZE || @@ -132,6 +140,8 @@ static int yramsim_wr_chunk (struct yaffs_dev *dev, int pageId, dout("wr_chunk\n"); + stats_writes++; + if(blockId >= sim->nBlocks || pageOffset >= PAGES_PER_BLOCK || dataLength >DATA_SIZE || @@ -157,6 +167,8 @@ static int yramsim_erase(struct yaffs_dev *dev, int blockId) { SimData *sim = DevToSim(dev); + stats_erases++; + CheckInitialised(); return yramsim_erase_internal(sim,blockId,0); } @@ -309,3 +321,11 @@ struct yaffs_dev *yaffs_rtems_flashsim_setup(void) 0, 99); } + +void yaffs_rtems_flashsim_dump_status(void) +{ + printf("\nFlashsim stats\n"); + printf("reads.....%d\n", stats_reads); + printf("writes....%d\n", stats_writes); + printf("erases....%d\n", stats_erases); +} diff --git a/rtems/rtems-y-test/common/yaffs-rtems-flashsim.h b/rtems/rtems-y-test/common/yaffs-rtems-flashsim.h index d9b5e41..50f259b 100644 --- a/rtems/rtems-y-test/common/yaffs-rtems-flashsim.h +++ b/rtems/rtems-y-test/common/yaffs-rtems-flashsim.h @@ -5,5 +5,7 @@ struct yaffs_dev; struct yaffs_dev *yaffs_rtems_flashsim_setup(void); +void yaffs_rtems_flashsim_dump_status(void); + #endif diff --git a/rtems/rtems-y-test/common/yaffs-rtems-test-wrapper.c b/rtems/rtems-y-test/common/yaffs-rtems-test-wrapper.c index 0ac7a67..4d23917 100644 --- a/rtems/rtems-y-test/common/yaffs-rtems-test-wrapper.c +++ b/rtems/rtems-y-test/common/yaffs-rtems-test-wrapper.c @@ -76,6 +76,8 @@ rtems_task Init( run_the_test(); + yaffs_rtems_flashsim_dump_status(); + exit(0); }