diff options
author | Marius <mariausol@gmail.com> | 2013-07-12 20:20:46 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-07-12 20:20:46 +0300 |
commit | b1d691809f3556327b45caf09444c50a77335b8f (patch) | |
tree | 8e85bb077d6680d1ea73a284a9ab3a0d26954628 /scripts/context/lua/mtx-profile.lua | |
parent | b10c48bc0fe2e5be7305c0f31e41ea01f8596c30 (diff) | |
download | context-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.lua | 32 |
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 |