- for l, t in pairs(model.accTime) do
- print(string.format('%s %s %.02fs (%.01fmus/sample)',
- indent,
- l,
- t,
- 1e6 * t / nbSamples))
- end
+ s = s .. string.format(profiler.colors('green') .. ' (%.01fmus/sample)', 1e6 * t / nbSamples)
+ end
+
+ s = s .. profiler.colors('black')
+
+ return s
+end
+
+function profiler.print(model, nbSamples, totalTime, indent)
+ local indent = indent or ''
+ local hint
+
+ local localTotal = 0
+ for _, t in pairs(model.accTime) do
+ localTotal = localTotal + t
+ end
+
+ totalTime = totalTime or localTotal
+
+ if torch.isTypeOf(model, nn.Container) then
+ hint = ' '