summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2020-04-16 11:12:05 -0700
committerChris Mason <clm@fb.com>2020-04-16 11:12:05 -0700
commit691e47dc6f9f4bb883b78b45a8a42bfee9a5526c (patch)
treeff70881c5879eb642ca96efcf479dc04a4716919
parent7011f12b89d17a3191d1d11e3cc39929438bcd9d (diff)
downloadsimoop-691e47dc6f9f4bb883b78b45a8a42bfee9a5526c.tar.gz
simoop: honor stopping in more places
This helps make sure we actually stop on time. Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--simoop.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/simoop.c b/simoop.c
index 5523f78..fac500a 100644
--- a/simoop.c
+++ b/simoop.c
@@ -1178,6 +1178,9 @@ static void write_pattern(int fd, void *xxhash_state, char *buf,
aligned_start += this_write;
length -= this_write;
+
+ if (stopping)
+ break;
}
}
@@ -1225,6 +1228,9 @@ static void read_and_crc(int fd, char *filename,
}
aligned_start += this_read;
length -= this_read;
+
+ if (stopping)
+ break;
}
}
@@ -1584,11 +1590,13 @@ void *read_thread(void *arg)
int i;
char *buf = arg;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 128; i++) {
int index = rand() % total_paths;
int seq = rand() % num_files;
char *path = paths[index];
read_from_file(path, seq, buf);
+ if (stopping)
+ break;
}
return NULL;
}
@@ -1616,11 +1624,13 @@ void *write_thread(void *arg)
char *buf = arg;
int i;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 128; i++) {
int index = rand() % total_paths;
int seq = rand() % num_files;
char *path = paths[index];
write_to_file(path, seq, buf);
+ if (stopping)
+ break;
}
return NULL;
}