Skip to content

Commit 5c0525c

Browse files
Add a warning if a region is never closed unexpectedly
1 parent a3b2d06 commit 5c0525c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/fiat/drhook/drhook.c

+11
Original file line numberDiff line numberDiff line change
@@ -4040,6 +4040,7 @@ c_drhook_print_(const int *ftnunitno,
40404040
)
40414041
{
40424042
static int first_time = 0;
4043+
static int reported_open_regions = 0;
40434044
int tid = (thread_id && (*thread_id >= 1) && (*thread_id <= numthreads))
40444045
? *thread_id : drhook_oml_get_thread_num();
40454046
int mytid = drhook_oml_get_thread_num();
@@ -4289,6 +4290,11 @@ c_drhook_print_(const int *ftnunitno,
42894290
cycles[t] += self_cycles;
42904291
}
42914292
nprof++;
4293+
} else if (keyptr->name && keyptr->status == 0 && !reported_open_regions) {
4294+
fprintf(stderr,
4295+
"%s %s [%s@%s:%d] WARNING: Region '%s' was never closed or stopped by a signal. No output will be produced for this region.\n",
4296+
pfx,TIMESTR(tid),FFL, keyptr->name);
4297+
reported_open_regions = 1;
42924298
}
42934299
keyptr = keyptr->next;
42944300
} /* while (keyptr && keyptr->status == 0) */
@@ -4611,6 +4617,11 @@ c_drhook_print_(const int *ftnunitno,
46114617
tot[t] += self;
46124618
maxseen_tot[t] = MAX(maxseen_tot[t], keyptr->mem_seenmax);
46134619
nprof++;
4620+
} else if (keyptr->name && keyptr->status == 0 && !reported_open_regions) {
4621+
fprintf(stderr,
4622+
"%s %s [%s@%s:%d] WARNING: Region '%s' was never closed or stopped by a signal. No output will be produced for this region.\n",
4623+
pfx,TIMESTR(tid),FFL, keyptr->name);
4624+
reported_open_regions = 1;
46144625
}
46154626
keyptr = keyptr->next;
46164627
} /* while (keyptr && keyptr->status == 0) */

0 commit comments

Comments
 (0)