diff --git a/M2/Macaulay2/d/profiler.dd b/M2/Macaulay2/d/profiler.dd index eb6440b440..e00ad42819 100644 --- a/M2/Macaulay2/d/profiler.dd +++ b/M2/Macaulay2/d/profiler.dd @@ -64,8 +64,21 @@ measure(c:Code):Expr := ( -- so that everytime evalraw recursively calls eval, this one runs. export evalprof(c:Code):Expr := ( -- stdIO << tostring(codePosition(c)) << " " << tostring(c) << endl; - stackpush(codePosition(c)); - stackpop(measure(c))); + when c + is f:functionCode do ( + stackpush(codePosition(c)); + stackpop(measure(c))) + is v:semiCode do ( + i := 0; + w := v.w; + r := nullE; + n := length(w); + while i < n do ( + stackpush(codePosition(c)); + r = stackpop(measure(w.i)); + i = when r is Error do n else i+1); + r) + else evalraw(c)); evalprofpointer = evalprof; -- briefly enables the profiler and evaluates the code that follows,