summaryrefslogtreecommitdiff
path: root/scripts/context/lua/mtx-profile.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-07-12 20:20:46 +0300
committerMarius <mariausol@gmail.com>2013-07-12 20:20:46 +0300
commitb1d691809f3556327b45caf09444c50a77335b8f (patch)
tree8e85bb077d6680d1ea73a284a9ab3a0d26954628 /scripts/context/lua/mtx-profile.lua
parentb10c48bc0fe2e5be7305c0f31e41ea01f8596c30 (diff)
downloadcontext-b1d691809f3556327b45caf09444c50a77335b8f.tar.gz
beta 2013.07.12 19:10
Diffstat (limited to 'scripts/context/lua/mtx-profile.lua')
-rw-r--r--scripts/context/lua/mtx-profile.lua32
1 files changed, 17 insertions, 15 deletions
diff --git a/scripts/context/lua/mtx-profile.lua b/scripts/context/lua/mtx-profile.lua
index 3550474f3..0d0c28084 100644
--- a/scripts/context/lua/mtx-profile.lua
+++ b/scripts/context/lua/mtx-profile.lua
@@ -31,7 +31,7 @@ local helpinfo = [[
]]
local application = logs.application {
- name = "mtx-cache",
+ name = "mtx-profile",
banner = "ConTeXt MkIV LuaTeX Profiler 1.00",
helpinfo = helpinfo,
}
@@ -56,20 +56,22 @@ function scripts.profiler.analyze(filename)
local times, counts, calls = { }, { }, { }
local totalruntime, totalcount, totalcalls = 0, 0, 0
for line in f:lines() do
- local stacklevel, filename, functionname, linenumber, currentline, localtime, totaltime = line:match("^(%d+)\t(.-)\t(.-)\t(.-)\t(.-)\t(.-)\t(.-)")
- if not filename then
- -- next
- elseif filename == "=[C]" then
- if not functionname:find("^%(") then
- calls[functionname] = (calls[functionname] or 0) + 1
- end
- else
- local filename = filename:match("^@(.*)$")
- if filename then
- local fi = times[filename]
- if not fi then fi = { } times[filename] = fi end
- fi[functionname] = (fi[functionname] or 0) + tonumber(localtime)
- counts[functionname] = (counts[functionname] or 0) + 1
+ if not find(line,"__index") and not find(line,"__newindex") then
+ local stacklevel, filename, functionname, linenumber, currentline, localtime, totaltime = line:match("^(%d+)\t(.-)\t(.-)\t(.-)\t(.-)\t(.-)\t(.-)")
+ if not filename then
+ -- next
+ elseif filename == "=[C]" then
+ if not functionname:find("^%(") then
+ calls[functionname] = (calls[functionname] or 0) + 1
+ end
+ else
+ local filename = filename:match("^@(.*)$")
+ if filename then
+ local fi = times[filename]
+ if not fi then fi = { } times[filename] = fi end
+ fi[functionname] = (fi[functionname] or 0) + tonumber(localtime)
+ counts[functionname] = (counts[functionname] or 0) + 1
+ end
end
end
end