diff options
author | Amit Shah <amit.shah@redhat.com> | 2009-04-13 16:50:28 +0530 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2009-04-13 16:58:58 +0530 |
commit | e51793b310401340899de51f75705dee367dd62f (patch) | |
tree | 4ef0895006f4a9027e5f5fec054b9ed9d65cc089 | |
parent | 6e11de0a98959885c3f81f6ecc05fdb4bfe08ccd (diff) | |
download | alloc-perf-e51793b310401340899de51f75705dee367dd62f.tar.gz alloc-perf-e51793b310401340899de51f75705dee367dd62f.tar.xz alloc-perf-e51793b310401340899de51f75705dee367dd62f.zip |
sync() before running any test to flush out data to disk
Flush out data in buffers / caches not belonging to our test. This data can
figure in our timings if the kernel decides to write them out during
our testing, so it's best to get it out beforehand.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r-- | test-file-zero-alloc-speed.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test-file-zero-alloc-speed.c b/test-file-zero-alloc-speed.c index fbd8a03..dacb1c2 100644 --- a/test-file-zero-alloc-speed.c +++ b/test-file-zero-alloc-speed.c @@ -50,6 +50,18 @@ int pre_test_setup(char *source, char *target, char *fstype, perror("open"); return -1; } + + /* Flush out all other data that might be pending writing to + * the disk. We don't want to count the time we wait for the + * buffers of other apps to clear. (Ideally, this test would + * be run in single user mode with nothing else running on the + * system.) + */ + sync(); + sync(); + /* Just to be sure - http://lwn.net/Articles/325420/ */ + sync(); + return 0; } |