diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-10-13 02:38:25 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-10-28 18:47:56 +0200 |
commit | 560ae3705ceb3e9cf139174ca61977f132bb982b (patch) | |
tree | 93f5096edbbf23b7eeb82ad4b869855795423bdb /Tools/MathematicaMisc | |
parent | 3c8cb5ca2dbbe69d103dcde0158febacddd6db6a (diff) |
Add disabled code for automatic profiling
Currently, enabling full profiling on all DefFn functions leads to a performance penalty. This needs to be investigated. However, profiling is still useful, so I am adding the code.
Diffstat (limited to 'Tools/MathematicaMisc')
-rw-r--r-- | Tools/MathematicaMisc/Errors.m | 2 | ||||
-rw-r--r-- | Tools/MathematicaMisc/RunKranc.m | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Tools/MathematicaMisc/Errors.m b/Tools/MathematicaMisc/Errors.m index 131997a..b085fdd 100644 --- a/Tools/MathematicaMisc/Errors.m +++ b/Tools/MathematicaMisc/Errors.m @@ -100,7 +100,7 @@ DefFn[def:(fn_[args___] := body_)] := Module[ {}, ErrorDefinition[fn]; - def]; + fn[args] := (*Profile[fn,*)body(*]*)]; End[]; diff --git a/Tools/MathematicaMisc/RunKranc.m b/Tools/MathematicaMisc/RunKranc.m index bd6dec6..b554c9c 100644 --- a/Tools/MathematicaMisc/RunKranc.m +++ b/Tools/MathematicaMisc/RunKranc.m @@ -8,6 +8,7 @@ $Path = Join[$Path, krancDir <> "/Tools/External"}]; Needs["Errors`"]; Needs["KrancThorn`"]; +Needs["Profile`"]; If[Environment["KRANCVERBOSE"] == "yes", SetDebugLevel[InfoFull]]; @@ -59,7 +60,23 @@ SetOptions["stdout", PageWidth -> Infinity]; exception = Catch[Catch[ Check[ - Get[script];None, + Block[ + {$RecursionLimit = Infinity}, + (*{result,timers} = GetTimers[ *) Get[script](*]*)]; + + (* Put[timers, "timer-output-1.m"]; *) + + (* timers = CoalesceTimers[timers]; *) + (* Put[timers, "timer-output-2.m"]; *) + + (* timers = ThresholdTimers[timers,0.1]; *) + (* Put[timers, "timer-output-3.m"]; *) + + (* (\* Put[timers2, "timer-output-2.m"]; *\) *) + + (* PrintTimerTree[timers]; *) + + None, ThrowError["Messages were generated - aborted"]]], _]; If[exception =!= None, |