X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=profiler-torch.git;a=blobdiff_plain;f=profiler.lua;h=b363a60a3cb76b7af10ddde42b431be6566f15ca;hp=231a7c90ffcfc33bfc69dd2f0003418cbca31263;hb=HEAD;hpb=384ad9105a3aa81e444141312b7194762f0abb51 diff --git a/profiler.lua b/profiler.lua index 231a7c9..b363a60 100644 --- a/profiler.lua +++ b/profiler.lua @@ -55,7 +55,7 @@ function profiler.decorate(model, functionsToDecorate) .. tostring(model)) end - local toDecorate = model + local toDecorate = getmetatable(model) while not rawget(toDecorate, name) do toDecorate = getmetatable(toDecorate) @@ -123,15 +123,14 @@ function profiler.print(model, nbSamples, totalTime, indent) hint = ' ' else if profiler.color then - hint = ' ' + hint = ' ' .. profiler.colors('red') else - hint = '*' + hint = '* ' end - hint = hint .. profiler.colors('red') end - print(profiler.timingString(indent .. hint .. ' ' .. model.__typename, - localTotal, nbSamples, totalTime)) + print(profiler.timingString(indent .. hint .. model.__typename, + localTotal, nbSamples, totalTime)) for l, t in pairs(model.accTime) do print(profiler.timingString(indent .. ' :' .. l, t, nbSamples, totalTime))