aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Ying <ying.huang@intel.com>2017-04-12 10:29:18 +0800
committerFengguang Wu <fengguang.wu@intel.com>2017-04-12 10:29:18 +0800
commitfe0353b13482d879c48d3841d15457a0fd5eca2c (patch)
tree68cc90527de515e14f2800a2654fd27fec72a81f
parentc1bb226a1bfcebe1d116a1627575c4b0ebf4545a (diff)
downloadvm-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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usemem.c b/usemem.c
index 867624f..f36b5c9 100644
--- a/usemem.c
+++ b/usemem.c
@@ -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;