Skip to content

Calculating worst case time littleFS will take to save all files in case of shutdown #1197

@i-g-g-y

Description

@i-g-g-y

Hello people.

I was wondering if there is a way to calculate the worst case time that littleFS needs to save all data before shutdown?

Given the config of filesystem, the hw used and its configuration, the known usage profile, is there a way to calculate reliably the worst case needed to save al data?

So far I have been measuring the sync times (I do a batch sync for all files periodically) and for 16 files I get lots of times in a few miliseconds, than one big jump around 350ms and if the system runs for long I catch up to two spikes in one sync batch.

This is statistics on a per-file basis:

Image

This is how the "batch sync" typically looks like:

SYNC file 0, duration: 4
SYNC file 1, duration: 4
SYNC file 2, duration: 4
SYNC file 3, duration: 4
SYNC file 4, duration: 4
SYNC file 5, duration: 3
SYNC file 6, duration: 352
SYNC file 7, duration: 2
SYNC file 8, duration: 4
SYNC file 9, duration: 4
SYNC file 10, duration: 4
SYNC file 11, duration: 3
SYNC file 12, duration: 4
SYNC file 13, duration: 4
SYNC file 14, duration: 4
SYNC file 15, duration: 4
SYNC LOG file: 0

But sometimes:

SYNC file 0: 0, duration: 352
SYNC file 1: 0, duration: 4
SYNC file 2: 0, duration: 4
SYNC file 3: 0, duration: 4
SYNC file 4: 0, duration: 4
SYNC file 5: 0, duration: 4
SYNC file 6: 0, duration: 4
SYNC file 7: 0, duration: 4
SYNC file 8: 0, duration: 3
SYNC file 9: 0, duration: 4
SYNC file 10: 0, duration: 4
SYNC file 11: 0, duration: 3
SYNC file 12: 0, duration: 4
SYNC file 13: 0, duration: 3
SYNC file 14: 0, duration: 352
SYNC file 15: 0, duration: 4

Statistics for the 16-file batch-sync:

Image

I do have a hard limit to save all data and I worry how long can it actually take in case of worst case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions