From 0c5f4739df52f8cf1782d7a608dfa49336e94844 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 7 Dec 2021 17:15:04 +0100 Subject: indexamajig: Generate per-frame profiling numbers --- src/im-sandbox.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/im-sandbox.c') 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; } -- cgit v1.2.3