diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-08-15 09:54:36 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-08-15 09:54:36 +0200 |
commit | 36a37da721032b8d02fad41f22ad717ee8136f34 (patch) | |
tree | 6481c1e6fca21c63679c03ad66800d505334c7b8 /tex/context/base/mkiv/util-deb.lua | |
parent | 1ef7a093aaf03b6327b3da94d47f53760c868c60 (diff) | |
download | context-36a37da721032b8d02fad41f22ad717ee8136f34.tar.gz |
2018-08-14 23:17:00
Diffstat (limited to 'tex/context/base/mkiv/util-deb.lua')
-rw-r--r-- | tex/context/base/mkiv/util-deb.lua | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tex/context/base/mkiv/util-deb.lua b/tex/context/base/mkiv/util-deb.lua index b8db0c583..9488a728b 100644 --- a/tex/context/base/mkiv/util-deb.lua +++ b/tex/context/base/mkiv/util-deb.lua @@ -98,7 +98,7 @@ end setmetatableindex(names,function(t,name) local v = setmetatableindex(function(t,source) local v = setmetatableindex(function(t,line) - local v = { total = 0, count = 0 } + local v = { total = 0, count = 0, nesting = 0 } t[line] = v return v end) @@ -128,12 +128,24 @@ local function hook(where) end local data = names[name][source][line] if where == "call" then - data.count = data.count + 1 - insert(data,ticks()) + local nesting = data.nesting + if nesting == 0 then + data.count = data.count + 1 + insert(data,ticks()) + data.nesting = 1 + else + data.nesting = nesting + 1 + end elseif where == "return" then - local t = remove(data) - if t then - data.total = data.total + ticks() - t + local nesting = data.nesting + if nesting == 1 then + local t = remove(data) + if t then + data.total = data.total + ticks() - t + end + data.nesting = 0 + else + data.nesting = nesting - 1 end end end |