diff options
author | Huang Ying <ying.huang@intel.com> | 2017-04-12 10:29:18 +0800 |
---|---|---|
committer | Fengguang Wu <fengguang.wu@intel.com> | 2017-04-12 10:29:18 +0800 |
commit | fe0353b13482d879c48d3841d15457a0fd5eca2c (patch) | |
tree | 68cc90527de515e14f2800a2654fd27fec72a81f | |
parent | c1bb226a1bfcebe1d116a1627575c4b0ebf4545a (diff) | |
download | vm-scalability-fe0353b13482d879c48d3841d15457a0fd5eca2c.tar.gz |
Avoid memory allocation/sync time when calculate throughput
The start time is changed to after allocate memory and sync between
tasks.
Signed-off-by: Huang Ying <ying.huang@intel.com>
-rw-r--r-- | usemem.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -66,7 +66,8 @@ unsigned long *prealloc; unsigned long *buffer; int sleep_secs = 0; time_t runtime_secs = 0; -struct timeval start_time; +__thread struct timeval start_time; +__thread int started = 0; int reps = 1; int do_mlock = 0; int do_getchar = 0; @@ -586,6 +587,12 @@ unsigned long do_unit(unsigned long bytes, struct drand48_data *rand_data, if (opt_sync_rw) ready(); + if (!started) { + /* Avoid timing memory allocation and syncing */ + gettimeofday(&start_time, NULL); + started = 1; + } + if (opt_write_signal_read) buffer = p; |