hi: thanks for your kind reply :) 2010/10/12 Greg Freemyer <greg.freemyer@xxxxxxxxx>: > On Sun, Oct 10, 2010 at 2:08 PM, loody <miloody@xxxxxxxxx> wrote: >> Dear all: >> I am so SORRY that I send the mail before I finish it, since I finger >> flip over the send button. >> SORRY~~~ >> >> i write a simple program as below to count the speed of writing a file >> over usb, gettimeofday before writing and gettimeofday when finish >> writing. but I found something make me curious. >> >> 1. my program is compiled as static and I use open, write instead of >> libc function calls. >> >> 2. I use the same kernel and usb modules, kernel version is 2.6.31 >> the only difference is I have 2 rootfs, both of them are >> cross-compiled as arm platform. >> Here comes the problem. >> the speed of the roofs1 I got is 8MB/s but rootfs2 is 1MB/s >> >> my concerns are: >> 1. my program is build as static, that means the libs in the roofs has >> nothing to do with this program. >> 2. my program is written with file I/O, instead of file operations >> supported by c lib, that means I direct calling kernel system call for >> writing data. If my assumption above are correct, that seems the >> kernel make me slow on rootfs2. >> >> 3. in the beginning, I thought there maybe some other program, like >> threads, running on rootfs2 which let my speed get slow. >> but how could I find them on the taret? >> 4. if I really want to find out whether the delay comes from kernel >> instead of usb or other driver module, is there configs I can open to >> monitor the write flow and found out where it stuck? >> appreciate your help, >> miloody > > You don't describe how your flushing the cache. > > i find most out of whack benchmarks like this are caused by not > properly managing the cache flushing process. > > Since you wrote your own "benchmark" tool, just be sure it calls > fsync() before closing the file and taking your time measurement. > > Greg > I mount the usb disk with sync option and that is the reason why it is so slow. BTW, theoretically random r/w should be the same speed as sequential r/w right? for usb device it just send sequential bulk command and random ones right? appreciate your help, miloody -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ