aboutsummaryrefslogtreecommitdiff
path: root/src/im-sandbox.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-12-07 17:15:04 +0100
committerThomas White <taw@physics.org>2021-12-07 17:20:18 +0100
commit0c5f4739df52f8cf1782d7a608dfa49336e94844 (patch)
treea50f4b2d0afc99f3d4fa60c8de55ac3f5886768b /src/im-sandbox.c
parentfe938a0ad2af037fff80114ca2832d41dc48e55e (diff)
indexamajig: Generate per-frame profiling numbers
Diffstat (limited to 'src/im-sandbox.c')
-rw-r--r--src/im-sandbox.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 9724c245..9115cb1b 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -329,7 +329,6 @@ static int run_work(const struct index_args *iargs, Stream *st,
int cookie, const char *tmpdir, struct sandbox *sb)
{
int allDone = 0;
- TimeAccounts *taccs;
struct im_zmq *zmqstuff = NULL;
/* Connect via ZMQ */
@@ -344,10 +343,9 @@ static int run_work(const struct index_args *iargs, Stream *st,
}
}
- taccs = time_accounts_init();
-
while ( !allDone ) {
+ TimeAccounts *taccs;
struct pattern_args pargs;
int ser;
char *line;
@@ -357,6 +355,8 @@ static int run_work(const struct index_args *iargs, Stream *st,
char *ser_str = NULL;
int ok = 1;
+ taccs = time_accounts_init();
+
/* Wait until an event is ready */
time_accounts_set(taccs, TACC_EVENTWAIT);
set_last_task(sb->shared->last_task[cookie], "wait_event");
@@ -456,15 +456,19 @@ static int run_work(const struct index_args *iargs, Stream *st,
/* pargs.zmq_data will be copied into the image structure, so
* that it can be queried for "header" values etc. It will
* eventually be freed by image_free() under process_image() */
+
+ if ( sb->profile ) {
+ pthread_mutex_lock(&sb->shared->term_lock);
+ time_accounts_print_short(taccs);
+ pthread_mutex_unlock(&sb->shared->term_lock);
+ }
+ time_accounts_free(taccs);
}
im_zmq_shutdown(zmqstuff);
- time_accounts_set(taccs, TACC_FINALCLEANUP);
cleanup_indexing(iargs->ipriv);
cell_free(iargs->cell);
- if ( sb->profile ) time_accounts_print(taccs);
- time_accounts_free(taccs);
return 0;
}