aboutsummaryrefslogtreecommitdiff
path: root/lua/timer.lua
diff options
context:
space:
mode:
authorQi Liu <[email protected]>2016-03-11 20:11:00 +0800
committerQi Liu <[email protected]>2016-03-11 20:11:00 +0800
commite2a9af061db485d4388902d738c9d8be3f94ab34 (patch)
tree468d6c6afa0801f6a6bf794b3674f8814b8827f7 /lua/timer.lua
parent2f46a5e2b37a054f482f76f4ac3d26b144cf988f (diff)
add recipe and fix bugs
Diffstat (limited to 'lua/timer.lua')
-rw-r--r--lua/timer.lua33
1 files changed, 0 insertions, 33 deletions
diff --git a/lua/timer.lua b/lua/timer.lua
deleted file mode 100644
index 2c54ca8..0000000
--- a/lua/timer.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-local Timer = nerv.class("nerv.Timer")
-
-function Timer:__init()
- self.last = {}
- self.rec = {}
-end
-
-function Timer:tic(item)
- self.last[item] = os.clock()
-end
-
-function Timer:toc(item)
- if (self.last[item] == nil) then
- nerv.error("item not there")
- end
- if (self.rec[item] == nil) then
- self.rec[item] = 0
- end
- self.rec[item] = self.rec[item] + os.clock() - self.last[item]
-end
-
-function Timer:check(item)
- if self.rec[item]==nil then
- nerv.error('item not there')
- end
- nerv.printf('"%s" lasts for %f secs.\n',item,self.rec[item])
-end
-
-function Timer:flush()
- for key, value in pairs(self.rec) do
- self.rec[key] = nil
- end
-end