How to read file with no-cache in Android? -


i working on test application on android platform. test write/read speed sdcard. write in c language ndk interface.

first write for-loop create 256 files 512 random bytes in each. part works fine. open file flag o_creat|o_wronly|o_sync , mode 0666. after call write, sync() make sure data written on card.

then write 2-level for-loop read these file test speed. use o_rdwr|o_sync open file. call read().

here thing: if first time run read part. first loop read take more time after. i'm sure because after first loop, program read cache not real physical card.

i've tried o_direct flag read. error einval. in man page open, says maybe because of function not implement platform.

do have idea on how read no-cache in android?

you may need rooted phone disable operating-system-level caching.

http://wiki.cyanogenmod.com/index.php?title=sdcardspeedtests

that takes care operations large enough overwhelm on-card buffers.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -