Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
rosinski committed Jan 1, 2007
1 parent f699a24 commit 35c956e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions gptl.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static Nofalse *current_depth;

static int nthreads = -1; /* num threads. Init to bad value */
static int maxthreads = -1; /* max threads (=nthreads for OMP). Init to bad value */
static int depthlimit = 99999; /* max depth for timers (99999 is effectively infinite) */
static bool disabled = false; /* Timers disabled? */
static bool initialized = false; /* GPTLinitialize has been called */
static time_t ref_gettimeofday = -1; /* reference start point for gettimeofday */
Expand Down Expand Up @@ -158,6 +159,10 @@ int GPTLsetoption (const int option, /* option */
overheadstats.enabled = (bool) val;
printf ("GPTLsetoption: set overheadstats to %d\n", val);
return 0;
case GPTLdepthlimit:
depthlimit = val;
printf ("GPTLsetoption: set depthlimit to %d\n", val);
return 0;
default:
break;
}
Expand Down Expand Up @@ -360,6 +365,16 @@ int GPTLstart (const char *name) /* timer name */
if ((t = get_thread_num (&nthreads, &maxthreads)) < 0)
return GPTLerror ("GPTLstart\n");

/*
** If current depth exceeds a user-specified limit for print, just
** increment and return
*/

if (current_depth[t].depth >= depthlimit) {
++current_depth[t].depth;
return 0;
}

/* Truncate input name if longer than MAX_CHARS characters */

nchars = MIN (strlen (name), MAX_CHARS);
Expand Down Expand Up @@ -497,6 +512,16 @@ int GPTLstop (const char *name) /* timer name */
if ( ! initialized)
return GPTLerror ("GPTLstop: GPTLinitialize has not been called\n");

/*
** If current depth exceeds a user-specified limit for print, just
** decrement and return
*/

if (current_depth[t].depth > depthlimit) {
--current_depth[t].depth;
return 0;
}

if ((t = get_thread_num (&nthreads, &maxthreads)) < 0)
return GPTLerror ("GPTLstop\n");

Expand Down

0 comments on commit 35c956e

Please sign in to comment.