aboutsummaryrefslogtreecommitdiff
path: root/src/jit/p.lua
diff options
context:
space:
mode:
authorMike Pall <mike>2013-09-10 00:02:20 +0200
committerMike Pall <mike>2013-09-10 00:02:20 +0200
commit29078518c14a4f49224fc58c57053bda2e8284dc (patch)
tree8112520c4b45e5a7953fcdeff8d23a7a1b2e44bf /src/jit/p.lua
parent2befb8b1de3c6dec4d326a01419615a8bab4eeef (diff)
downloadluajit-29078518c14a4f49224fc58c57053bda2e8284dc.tar.gz
luajit-29078518c14a4f49224fc58c57053bda2e8284dc.tar.bz2
luajit-29078518c14a4f49224fc58c57053bda2e8284dc.zip
Add -jp=fl mode and minor fixes.
Diffstat (limited to 'src/jit/p.lua')
-rw-r--r--src/jit/p.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/jit/p.lua b/src/jit/p.lua
index f3bec9f0..1fbf389a 100644
--- a/src/jit/p.lua
+++ b/src/jit/p.lua
@@ -21,7 +21,7 @@
21-- 21--
22-- The following dump features are available: 22-- The following dump features are available:
23-- 23--
24-- f Stack dump: function name, Otherwise module:line. Default mode 24-- f Stack dump: function name, otherwise module:line. Default mode.
25-- F Stack dump: ditto, but always prepend module. 25-- F Stack dump: ditto, but always prepend module.
26-- l Stack dump: module:line. 26-- l Stack dump: module:line.
27-- <number> stack dump depth (callee < caller). Default: 1. 27-- <number> stack dump depth (callee < caller). Default: 1.
@@ -33,7 +33,7 @@
33-- r Show raw sample counts. Default: show percentages. 33-- r Show raw sample counts. Default: show percentages.
34-- a Annotate excerpts from source code files. 34-- a Annotate excerpts from source code files.
35-- A Annotate complete source code files. 35-- A Annotate complete source code files.
36-- G Produce output suitable for graphical tools (e.g. flame graphs). 36-- G Produce raw output suitable for graphical tools (e.g. flame graphs).
37-- m<number> Minimum sample percentage to be shown. Default: 3. 37-- m<number> Minimum sample percentage to be shown. Default: 3.
38-- i<number> Sampling interval in milliseconds. Default: 10. 38-- i<number> Sampling interval in milliseconds. Default: 10.
39-- 39--
@@ -87,6 +87,8 @@ local function prof_cb(th, samples, vmmode)
87 if prof_split == 2 then 87 if prof_split == 2 then
88 local k1, k2 = key_stack:match("(.-) [<>] (.*)") 88 local k1, k2 = key_stack:match("(.-) [<>] (.*)")
89 if k2 then key_stack, key_stack2 = k1, k2 end 89 if k2 then key_stack, key_stack2 = k1, k2 end
90 elseif prof_split == 3 then
91 key_stack2 = profile.dumpstack(th, "l", 1)
90 end 92 end
91 end 93 end
92 -- Order keys. 94 -- Order keys.
@@ -138,7 +140,8 @@ local function prof_top(count1, count2, samples, indent)
138 if count2 then 140 if count2 then
139 local r = count2[k] 141 local r = count2[k]
140 if r then 142 if r then
141 prof_top(r, nil, v, prof_depth < 0 and " -> " or " <- ") 143 prof_top(r, nil, v, (prof_split == 3 or prof_split == 1) and " -- " or
144 (prof_depth < 0 and " -> " or " <- "))
142 end 145 end
143 end 146 end
144 end 147 end
@@ -221,7 +224,7 @@ local function prof_finish()
221 profile.stop() 224 profile.stop()
222 local samples = prof_samples 225 local samples = prof_samples
223 if samples == 0 then 226 if samples == 0 then
224 if prof_raw ~= true then out:write("[no samples collected]\n") end 227 if prof_raw ~= true then out:write("[No samples collected]\n") end
225 return 228 return
226 end 229 end
227 if prof_ann then 230 if prof_ann then
@@ -254,6 +257,9 @@ local function prof_start(mode)
254 prof_split = 2 257 prof_split = 2
255 if prof_depth == -1 or m["-"] then prof_depth = -2 258 if prof_depth == -1 or m["-"] then prof_depth = -2
256 elseif prof_depth == 1 then prof_depth = 2 end 259 elseif prof_depth == 1 then prof_depth = 2 end
260 elseif mode:find("[fF].*l") then
261 scope = "l"
262 prof_split = 3
257 else 263 else
258 prof_split = (scope == "" or mode:find("[zv].*[lfF]")) and 1 or 0 264 prof_split = (scope == "" or mode:find("[zv].*[lfF]")) and 1 or 0
259 end 265 end
@@ -271,7 +277,8 @@ local function prof_start(mode)
271 elseif scope == "" then 277 elseif scope == "" then
272 prof_fmt = false 278 prof_fmt = false
273 else 279 else
274 prof_fmt = flags..scope..(prof_depth >= 0 and "Z < " or "Z > ") 280 local sc = prof_split == 3 and m.f or m.F or scope
281 prof_fmt = flags..sc..(prof_depth >= 0 and "Z < " or "Z > ")
275 end 282 end
276 prof_count1 = {} 283 prof_count1 = {}
277 prof_count2 = {} 284 prof_count2 = {}