Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing tracking counters for wear analysis and other performance analysis (erase, write, and read block counters) #941

Open
cmorganBE opened this issue Feb 8, 2024 · 1 comment

Comments

@cmorganBE
Copy link

Reviewing lfs.h and the port for esp32 I'm using here I don't see any tracking counters exposed from littlefs.

It would be helpful for embedded use to be able to retrieve counters of page writes and page erases from littlefs to aid in the analysis of product lifespan.

The simple analysis is to look at the datarate from the application into littlefs, however this excludes overhead and other internal management of the filesystem that may add overhead. Having run-time counters (stored in ram, not persisted to the filesystem), for erases, block writes, and block reads, a block read count could let you examine if your application's workload was somehow causing more reads than anticipated, would provide the information necessary for an analysis.

Thoughts?

@geky
Copy link
Member

geky commented Feb 17, 2024

Hi @cmorganBE, thanks for creating an issue.

This is an interesting idea. One could imagine an optional define that makes these counters available through lfs_fs_stat.

Though I wonder if inside the filesystem is the best place for these. You could also add the counters to the block device itself, and query the block device outside the filesystem. That way you could also measure any overhead introduced by other block device layers (FTL, ECC, etc).

This is what we do in emubd for running local (no-hardware) benchmarks:

littlefs/bd/lfs_emubd.h

Lines 199 to 206 in f53a0cc

// Get total amount of bytes read
lfs_emubd_sio_t lfs_emubd_readed(const struct lfs_config *cfg);
// Get total amount of bytes programmed
lfs_emubd_sio_t lfs_emubd_proged(const struct lfs_config *cfg);
// Get total amount of bytes erased
lfs_emubd_sio_t lfs_emubd_erased(const struct lfs_config *cfg);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants