summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2017-07-31 13:36:18 -0700
committerChris Mason <clm@fb.com>2017-07-31 13:36:18 -0700
commitc585b5e0a9a3ac5403484dc80827a6c1c52333f7 (patch)
tree2c963bf2022f062e6dd7fc3b3354df76822c1359
parentdc487544aa0bfe68169450f5a5985bc147abac5f (diff)
downloadsimoop-c585b5e0a9a3ac5403484dc80827a6c1c52333f7.tar.gz
Add -N to skip cleanup of temp and results files
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--simoop.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/simoop.c b/simoop.c
index 6c25bb8..9536dc8 100644
--- a/simoop.c
+++ b/simoop.c
@@ -105,6 +105,9 @@ static int sleeptime = 10000;
/* should we use fallocate instead of writing initial file contents */
static int zallocate = 0;
+/* should we delete the .tmp and .results files? */
+static int nocleanup = 0;
+
static uint64_t global_rand_seed = 0x89ABCEF;
/*
@@ -422,7 +425,7 @@ unsigned long long parse_size(char *s)
return ret;
}
-char *option_string = "t:s:C:c:r:n:f:FR:T:m:W:M:w:i:D:oaOVz";
+char *option_string = "t:s:C:c:r:n:f:FR:T:m:W:M:w:i:D:oaOVzN";
static struct option long_options[] = {
{"appendmode", required_argument, 0, 'a'},
{"mmapsize", required_argument, 0, 'M'},
@@ -445,6 +448,7 @@ static struct option long_options[] = {
{"odirect", no_argument, 0, 'O'},
{"verifystartup", no_argument, 0, 'V'},
{"zallocate", no_argument, 0, 'z'},
+ {"nocleanup", no_argument, 0, 'N'},
{"help", no_argument, 0, HELP_LONG_OPT},
{0, 0, 0, 0}
};
@@ -473,6 +477,7 @@ static void print_usage(void)
"\t-o (--oddsizes): randomize sizes to unaligned values\n"
"\t-O (--odirect): use O_DIRECT sometimes\n"
"\t-z (--zallocate): use fallocate for initial file creation\n"
+ "\t-N (--nocleanup): don't cleanup temp files from the last run\n"
"\t dir1 [dir2 ... dirN]\n"
"\nall sizes are in bytes k,m,g,t modifiers can be used\n"
);
@@ -906,6 +911,9 @@ static void unlink_extra(char *path, int seq, char *buf, size_t buf_size)
char name[NAME_LEN];
int ret;
+ if (nocleanup)
+ return;
+
join_path(name, path, seq, RESULT_FILE);
if (check_initial_files)
read_whole_file(path, seq, RESULT_FILE, buf, buf_size);