Commit 2b17d257 authored by Shane Snyder's avatar Shane Snyder

Bug fixes for replay tool

- Replay tool no longer offers bglockless prefix (ignored for POSIX
calls).
- Print workload load time on rank 0
- convert sleep functionality to use more accurate nanosleep
parent ebd968d5
...@@ -40,7 +40,6 @@ int hash_file_compare(void *key, struct qlist_head *link); ...@@ -40,7 +40,6 @@ int hash_file_compare(void *key, struct qlist_head *link);
/* command line options */ /* command line options */
static int opt_verbose = 0; static int opt_verbose = 0;
static int opt_noop = 0; static int opt_noop = 0;
static int opt_lockless = 0;
static double opt_delay_pct = 1.0; static double opt_delay_pct = 1.0;
/* hash table for storing file descriptors of opened files */ /* hash table for storing file descriptors of opened files */
...@@ -67,7 +66,6 @@ void usage(char *exename) ...@@ -67,7 +66,6 @@ void usage(char *exename)
fprintf(stderr, "\t<workload_test_dir> : the directory to replay the workload I/O in\n"); fprintf(stderr, "\t<workload_test_dir> : the directory to replay the workload I/O in\n");
fprintf(stderr, "\n\t[OPTIONS] includes:\n"); fprintf(stderr, "\n\t[OPTIONS] includes:\n");
fprintf(stderr, "\t\t--noop : do not perform i/o\n"); fprintf(stderr, "\t\t--noop : do not perform i/o\n");
fprintf(stderr, "\t\t--lockless : use bgq lockless file i/o optimization\n");
fprintf(stderr, "\t\t -v : verbose (output i/o details)\n"); fprintf(stderr, "\t\t -v : verbose (output i/o details)\n");
exit(1); exit(1);
...@@ -81,7 +79,6 @@ void parse_args(int argc, char **argv, char **conf_path, char **test_dir) ...@@ -81,7 +79,6 @@ void parse_args(int argc, char **argv, char **conf_path, char **test_dir)
{"conf", 1, NULL, 'c'}, {"conf", 1, NULL, 'c'},
{"test-dir", 1, NULL, 'd'}, {"test-dir", 1, NULL, 'd'},
{"noop", 0, NULL, 'n'}, {"noop", 0, NULL, 'n'},
{"lockless", 0, NULL, 'l'},
{"delay", 1, NULL, 'p'}, {"delay", 1, NULL, 'p'},
{"help", 0, NULL, 0}, {"help", 0, NULL, 0},
{0, 0, 0, 0} {0, 0, 0, 0}
...@@ -104,9 +101,6 @@ void parse_args(int argc, char **argv, char **conf_path, char **test_dir) ...@@ -104,9 +101,6 @@ void parse_args(int argc, char **argv, char **conf_path, char **test_dir)
case 'n': case 'n':
opt_noop = 1; opt_noop = 1;
break; break;
case 'l':
opt_lockless = 1;
break;
case 'c': case 'c':
*conf_path = optarg; *conf_path = optarg;
break; break;
...@@ -175,6 +169,7 @@ int load_workload(char *conf_path, int rank) ...@@ -175,6 +169,7 @@ int load_workload(char *conf_path, int rank)
strcpy(b_params.io_kernel_path, ""); strcpy(b_params.io_kernel_path, "");
strcpy(b_params.io_kernel_def_path, ""); strcpy(b_params.io_kernel_def_path, "");
b_params.num_cns = atoi(rank_count); b_params.num_cns = atoi(rank_count);
b_params.use_relpath = 1;
return codes_workload_load(workload_type, (char *)&b_params, rank); return codes_workload_load(workload_type, (char *)&b_params, rank);
} }
...@@ -209,7 +204,6 @@ int main(int argc, char *argv[]) ...@@ -209,7 +204,6 @@ int main(int argc, char *argv[])
struct codes_workload_op next_op; struct codes_workload_op next_op;
long long int replay_op_number = 1; long long int replay_op_number = 1;
double load_start, load_end; double load_start, load_end;
int first_op = 1;
int ret = 0; int ret = 0;
int i; int i;
...@@ -273,26 +267,14 @@ int main(int argc, char *argv[]) ...@@ -273,26 +267,14 @@ int main(int argc, char *argv[])
/* loading is finished */ /* loading is finished */
load_end = MPI_Wtime(); load_end = MPI_Wtime();
if (myrank == 0) printf("Note: Workload took %.2lf seconds to load.\n", load_end - load_start);
/* replay loop */ /* replay loop */
while (1) while (1)
{ {
/* get the next replay operation from the workload generator */ /* get the next replay operation from the workload generator */
codes_workload_get_next(workload_id, myrank, &next_op); codes_workload_get_next(workload_id, myrank, &next_op);
/* subtract the load time from any initial delay to be fair */
if (first_op && (next_op.op_type == CODES_WK_DELAY))
{
first_op = 0;
if (next_op.u.delay.seconds > (load_end - load_start))
{
next_op.u.delay.seconds -= (load_end - load_start);
}
else
{
continue;
}
}
if (next_op.op_type != CODES_WK_END) if (next_op.op_type != CODES_WK_END)
{ {
...@@ -333,8 +315,7 @@ error_exit: ...@@ -333,8 +315,7 @@ error_exit:
int replay_workload_op(struct codes_workload_op replay_op, int rank, long long int op_number) int replay_workload_op(struct codes_workload_op replay_op, int rank, long long int op_number)
{ {
unsigned int secs; struct timespec delay;
unsigned int usecs;
int open_flags = O_RDWR; int open_flags = O_RDWR;
char file_name[250]; char file_name[250];
int fildes; int fildes;
...@@ -357,9 +338,10 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i ...@@ -357,9 +338,10 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i
if (!opt_noop) if (!opt_noop)
{ {
/* satisfy delay using second delay then microsecond delay */ /* satisfy delay using second delay then microsecond delay */
secs = (unsigned int)replay_op.u.delay.seconds; delay.tv_sec = (long long)replay_op.u.delay.seconds;
usecs = (unsigned int)((replay_op.u.delay.seconds - secs) * 1000 * 1000); delay.tv_nsec = (unsigned int)((replay_op.u.delay.seconds - delay.tv_sec) *
ret = sleep(secs); 1000 * 1000 * 1000);
ret = nanosleep(&delay, NULL);
if (ret) if (ret)
{ {
/* error in sleep */ /* error in sleep */
...@@ -368,14 +350,6 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i ...@@ -368,14 +350,6 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i
rank, op_number, strerror(errno)); rank, op_number, strerror(errno));
return -1; return -1;
} }
ret = usleep(usecs);
if (ret < 0)
{
/* error in usleep */
fprintf(stderr, "Rank %d failure on operation %lld [DELAY: %s]\n",
rank, op_number, strerror(errno));
return -1;
}
#if DEBUG_PROFILING #if DEBUG_PROFILING
end = MPI_Wtime(); end = MPI_Wtime();
total_delay_time += (end - start); total_delay_time += (end - start);
...@@ -416,11 +390,7 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i ...@@ -416,11 +390,7 @@ int replay_workload_op(struct codes_workload_op replay_op, int rank, long long i
open_flags |= O_CREAT; open_flags |= O_CREAT;
/* write the file hash to string to be used as the actual file name */ /* write the file hash to string to be used as the actual file name */
if (!opt_lockless) snprintf(file_name, sizeof(file_name), "%"PRIu64, replay_op.u.open.file_id);
snprintf(file_name, sizeof(file_name), "%"PRIu64, replay_op.u.open.file_id);
else
snprintf(file_name, sizeof(file_name), "bglockless:%"PRIu64,
replay_op.u.open.file_id);
/* perform the open operation */ /* perform the open operation */
fildes = open(file_name, open_flags, 0666); fildes = open(file_name, open_flags, 0666);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment