I'm building a benchmark project between android device and sd-cards to track performance changes between different types of sd-cards.
In my benchmark I'm using many io methods, and both logical and physical access to the sd-card.
Sometimes I control the size of the internal buffer (with setnvbuf()
)
Between each file read/write I would like to clear the system's cache or internal buffer. What is the best way to manage this?
My project is partially native, using ndk, so I can use a c/cpp approach if needed.
Thanks.
Bench marking file systems is hard. There are various levels of caching. When you make i/o operations Linux (kernel) will cache your data and it is hard to manage that cache, see this cyanogenmod wiki page for example. In fact you shouldn't ever rely on such mechanism, but instead use longer running tests to see sdcards' performance - which in general brick them (I'm serious).
Checking long lived projects doing file system benchmarks is also a very good idea, for example iozone.