Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
fix issue 9783: fix tree time when profiling recursive functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rainers committed Mar 22, 2013
1 parent 1f1b0d3 commit f84708e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rt/trace.d
Expand Up @@ -51,6 +51,7 @@ struct Symbol
timer_t totaltime; // aggregate time
timer_t functime; // time excluding subfunction calls
ubyte Sflags;
uint recursion; // call recursion level
char[] Sident; // name of symbol
}

Expand Down Expand Up @@ -542,6 +543,7 @@ static void trace_pro(char[] id)
trace_tos.starttime = starttime;
trace_tos.ohd = trace_ohd + t - starttime;
trace_tos.subtime = 0;
s.recursion++;
//printf("trace_tos.ohd=%lld, trace_ohd=%lld + t=%lld - starttime=%lld\n",
// trace_tos.ohd,trace_ohd,t,starttime);
}
Expand Down Expand Up @@ -578,7 +580,9 @@ void _c_trace_epi()

// totaltime is time spent in this function + all time spent in
// subfunctions - bookkeeping overhead.
trace_tos.sym.totaltime += totaltime;
trace_tos.sym.recursion--;
if(trace_tos.sym.recursion == 0)
trace_tos.sym.totaltime += totaltime;

//if (totaltime < trace_tos.subtime)
//printf("totaltime=%lld < trace_tos.subtime=%lld\n",totaltime,trace_tos.subtime);
Expand Down

0 comments on commit f84708e

Please sign in to comment.