diff options
author | Thomas White <taw@physics.org> | 2014-07-24 15:43:13 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-07-24 15:43:13 +0200 |
commit | 901c99a1dbe1b9f93b8ecc3bff7bc6b80cc59904 (patch) | |
tree | dc16feaf83c14c3cbbdae461de378ae270614d94 /src | |
parent | 7141d24cce2edfcafae40dce6213c108798e9dc5 (diff) |
Suspend indexing statistics while --int-diag is displaying
Diffstat (limited to 'src')
-rw-r--r-- | src/im-sandbox.c | 44 | ||||
-rw-r--r-- | src/process_image.c | 6 | ||||
-rw-r--r-- | src/process_image.h | 6 |
3 files changed, 37 insertions, 19 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c index 3e2ab2b3..7305dfd4 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -3,13 +3,13 @@ * * Sandbox for indexing * - * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * Copyright © 2012 Richard Kirian * Copyright © 2012 Lorenzo Galli * * Authors: - * 2010-2013 Thomas White <taw@physics.org> + * 2010-2014 Thomas White <taw@physics.org> * 2011 Richard Kirian * 2012 Lorenzo Galli * 2012 Chunhong Yoon @@ -90,6 +90,7 @@ struct sandbox int n_hadcrystals_last_stats; int n_crystals_last_stats; int t_last_stats; + int suspend_stats; struct index_args *iargs; @@ -218,7 +219,8 @@ static void run_work(const struct index_args *iargs, pargs.filename = line; pargs.n_crystals = 0; - process_image(iargs, &pargs, st, cookie, tmpdir); + process_image(iargs, &pargs, st, cookie, tmpdir, + results_pipe); /* Request another image */ c = sprintf(buf, "%i\n", pargs.n_crystals); @@ -650,6 +652,7 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, sb->n_hadcrystals_last_stats = 0; sb->n_crystals_last_stats = 0; sb->t_last_stats = get_monotonic_seconds(); + sb->suspend_stats = 0; sb->n_proc = n_proc; sb->iargs = iargs; @@ -824,19 +827,32 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, chomp(results); - strtol(results, &eptr, 10); - if ( eptr == results ) { - if ( strlen(results) > 0 ) { - ERROR("Invalid result '%s'\n", results); + if ( strcmp(results, "SUSPEND") == 0 ) { + sb->suspend_stats++; + } else if ( strcmp(results, "RELEASE") == 0 ) { + if ( sb->suspend_stats > 0 ) { + sb->suspend_stats--; + } else { + ERROR("RELEASE before SUSPEND.\n"); } } else { - int nc = atoi(results); - sb->n_crystals += nc; - if ( nc > 0 ) { - sb->n_hadcrystals++; + strtol(results, &eptr, 10); + if ( eptr == results ) { + if ( strlen(results) > 0 ) { + ERROR("Invalid result '%s'\n", + results); + } + } else { + + int nc = atoi(results); + sb->n_crystals += nc; + if ( nc > 0 ) { + sb->n_hadcrystals++; + } + sb->n_processed++; + } - sb->n_processed++; } @@ -867,7 +883,9 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, /* Update progress */ lock_sandbox(sb); tNow = get_monotonic_seconds(); - if ( tNow >= sb->t_last_stats+STATS_EVERY_N_SECONDS ) { + if ( !sb->suspend_stats + && (tNow >= sb->t_last_stats+STATS_EVERY_N_SECONDS) ) + { STATUS("%4i indexable out of %4i processed (%4.1f%%), " "%4i crystals so far. " diff --git a/src/process_image.c b/src/process_image.c index 4751073b..0ec058ac 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -51,7 +51,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, - Stream *st, int cookie, const char *tmpdir) + Stream *st, int cookie, const char *tmpdir, int results_pipe) { float *data_for_measurement; size_t data_size; @@ -184,10 +184,10 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, /* Integrate all the crystals at once - need all the crystals so that * overlaps can be detected. */ - integrate_all_2(&image, iargs->int_meth, iargs->push_res, + integrate_all_4(&image, iargs->int_meth, PMODEL_SPHERE, iargs->push_res, iargs->ir_inn, iargs->ir_mid, iargs->ir_out, iargs->int_diag, iargs->int_diag_h, - iargs->int_diag_k, iargs->int_diag_l); + iargs->int_diag_k, iargs->int_diag_l, results_pipe); write_chunk(st, &image, hdfile, iargs->stream_peaks, iargs->stream_refls); diff --git a/src/process_image.h b/src/process_image.h index 1a8a9ff3..98228f6f 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -3,11 +3,11 @@ * * The processing pipeline for one image * - * Copyright © 2012-2013 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2010-2013 Thomas White <taw@physics.org> + * 2010-2014 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -97,7 +97,7 @@ struct pattern_args extern void process_image(const struct index_args *iargs, struct pattern_args *pargs, Stream *st, - int cookie, const char *tmpdir); + int cookie, const char *tmpdir, int results_pipe); #endif /* PROCESS_IMAGEs_H */ |