Add notice when no samples were collected by -jp.

This commit is contained in:
Mike Pall 2013-09-08 02:50:48 +02:00
parent f8e36535f7
commit d3d30d389b

View File

@ -119,7 +119,6 @@ local function prof_top(count1, count2, samples, indent)
n = n + 1 n = n + 1
t[n] = k t[n] = k
end end
if not t[1] then return end
sort(t, function(a, b) return count1[a] > count1[b] end) sort(t, function(a, b) return count1[a] > count1[b] end)
local raw = prof_raw local raw = prof_raw
for i=1,min(n, prof_maxn) do for i=1,min(n, prof_maxn) do
@ -148,7 +147,10 @@ local function prof_finish()
if prof_ud then if prof_ud then
profile.stop() profile.stop()
local samples = prof_samples local samples = prof_samples
if samples == 0 then return end if samples == 0 then
if prof_raw ~= true then out:write("[no samples collected]\n") end
return
end
prof_top(prof_count1, prof_count2, samples, "") prof_top(prof_count1, prof_count2, samples, "")
prof_count1 = nil prof_count1 = nil
prof_count2 = nil prof_count2 = nil