Added a proper error when trying to print the timing for an undecorated model.
authorFrancois Fleuret <francois@fleuret.org>
Tue, 6 Dec 2016 10:02:35 +0000 (11:02 +0100)
committerFrancois Fleuret <francois@fleuret.org>
Tue, 6 Dec 2016 10:02:35 +0000 (11:02 +0100)
profiler.lua

index 4fec258..f57c9d8 100644 (file)
@@ -115,6 +115,10 @@ function profiler.print(model, nbSamples, totalTime, indent)
    local indent = indent or ''
    local hint
 
+   if not model.accTime then
+      error('The model does not seem decorated for profiling.')
+   end
+
    local localTotal = 0
    for _, t in pairs(model.accTime) do
       localTotal = localTotal + t