From 7fcddbf213e2674871ef078a3b228a32fd9f488f Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 23 Sep 2019 10:29:32 +0200 Subject: indexamajig: Move 'profile' flag out of iargs --- src/im-sandbox.c | 8 +++++--- src/im-sandbox.h | 2 +- src/indexamajig.c | 8 +++++--- src/process_image.h | 1 - 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/im-sandbox.c b/src/im-sandbox.c index dacc2dbb..da632618 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -81,6 +81,7 @@ struct sandbox int *running; time_t *last_response; int last_ping[MAX_NUM_WORKERS]; + int profile; /* Whether to do wall-clock time profiling */ /* Streams to read from (NB not the same indices as the above) */ int n_read; @@ -481,7 +482,7 @@ static int run_work(const struct index_args *iargs, Stream *st, free(iargs->hdf5_peak_path); free_imagefile_field_list(iargs->copyme); cell_free(iargs->cell); - if ( iargs->profile ) time_accounts_print(taccs); + if ( sb->profile ) time_accounts_print(taccs); time_accounts_free(taccs); return 0; } @@ -1044,7 +1045,7 @@ char *create_tempdir(const char *temp_location) int create_sandbox(struct index_args *iargs, int n_proc, char *prefix, int config_basename, FILE *fh, Stream *stream, const char *tmpdir, int serial_start, - const char *zmq_address) + const char *zmq_address, int profile) { int i; struct sandbox *sb; @@ -1073,6 +1074,7 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix, sb->iargs = iargs; sb->serial = serial_start; sb->tmpdir = tmpdir; + sb->profile = profile; if ( zmq_address != NULL ) { sb->zmq = 1; sb->zmq_address = zmq_address; @@ -1226,7 +1228,7 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix, * waitpid() returns -1 and the loop still exits. */ } - if ( iargs->profile ) time_accounts_print(taccs); + if ( profile ) time_accounts_print(taccs); time_accounts_free(taccs); sem_unlink(semname_q); diff --git a/src/im-sandbox.h b/src/im-sandbox.h index 9da11526..2c43a543 100644 --- a/src/im-sandbox.h +++ b/src/im-sandbox.h @@ -84,6 +84,6 @@ extern void set_last_task(char *lt, const char *task); extern int create_sandbox(struct index_args *iargs, int n_proc, char *prefix, int config_basename, FILE *fh, Stream *stream, const char *tempdir, int serial_start, - const char *zmq_address); + const char *zmq_address, int profile); #endif /* IM_SANDBOX_H */ diff --git a/src/indexamajig.c b/src/indexamajig.c index 15dc19c6..bb115cc3 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -112,6 +112,7 @@ struct indexamajig_arguments int if_peaks; int if_multi; int if_retry; + int profile; /* Whether to do wall-clock time profiling */ TakeTwoOptions **taketwo_opts_ptr; FelixOptions **felix_opts_ptr; @@ -185,7 +186,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) break; case 204 : - args->iargs.profile = 1; + args->profile = 1; break; case 205 : @@ -615,6 +616,7 @@ int main(int argc, char *argv[]) args.if_multi = 0; args.if_retry = 1; args.if_checkcell = 1; + args.profile = 0; args.taketwo_opts_ptr = &taketwo_opts; args.felix_opts_ptr = &felix_opts; args.xgandalf_opts_ptr = &xgandalf_opts; @@ -675,7 +677,6 @@ int main(int argc, char *argv[]) args.iargs.fix_profile_r = -1.0; args.iargs.fix_bandwidth = -1.0; args.iargs.fix_divergence = -1.0; - args.iargs.profile = 0; args.iargs.no_image_data = 0; argp_program_version_hook = show_version; @@ -1054,7 +1055,8 @@ int main(int argc, char *argv[]) } r = create_sandbox(&args.iargs, args.n_proc, args.prefix, args.basename, - fh, st, tmpdir, args.serial_start, zmq_address); + fh, st, tmpdir, args.serial_start, zmq_address, + args.profile); free_imagefile_field_list(args.iargs.copyme); cell_free(args.iargs.cell); diff --git a/src/process_image.h b/src/process_image.h index c32df634..1b899619 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -110,7 +110,6 @@ struct index_args float fix_bandwidth; float fix_divergence; int overpredict; - int profile; /* Whether or not to do wall clock profiling */ Spectrum *spectrum; signed int wait_for_file; /* -1 means wait forever */ int no_image_data; -- cgit v1.2.3