mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-15 23:50:38 +00:00
feat(addons): zhCN localization for ClassicAPI_DebugTools and 6 missing globals fix (#141)
* feat(debugtools): add zhCN localization for ClassicAPI_DebugTools
* fix(locales): add 6 missing global strings to zhCN
* feat(debugtools): clean up slash command dispatch and add help subcommand
* fix(debugtools): use %s instead of %d in PROFILER_CALLS_FORMAT
ns.Count() always returns a string (either a formatted number or '-'),
never a number. Feeding it to %d causes format() to throw. Change the
locale template to %s so both '-', '1,234', etc. render correctly.
* fix(debugtools): repair regressions from the localization pass
- XML labels: 1.12's Button/FontString loader passes the text attribute
verbatim to FrameScript_GetText (0x703BF0), which reads the global of
exactly that name and falls back to the raw value. Nothing strips
"$...$", so text="$TI_SHOW$" rendered as literal "$TI_SHOW$". Use the
bare global name, as stock FrameXML does.
- Tabs: ns.AddTab(name, label) keeps a fixed English key for ns.ShowIn
and a separate localized button label. Keying tabs by the translated
name made ShowIn("Globals") return nil and error on a zhCN client.
- Frames tab state: restore visible / "shown, parent hidden" / hidden.
The inverted branch reported a shown frame under a hidden parent as
hidden and made the third state unreachable.
- /profiler: unknown or incomplete subcommands print the usage again
instead of doing nothing.
- Deep Tracking / CPU Profiling buttons: split the label from ON/OFF so
the state keeps its accent / grey colour.
- Restore the gap between owner and CPU time in the frame-stack and
Frames-tab tooltips, and the leading space of " (replaced)".
- zhCN: ADDON_OPTIONS titles the shared Interface Options panel and the
game-menu button, not ClassicAPI's own settings; revert to 插件设置.
---------
Co-authored-by: jilinge <jilinge@users.noreply.github.com>
Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
This commit is contained in:
@@ -76,7 +76,7 @@ CLASSICAPI_MOTION = "动态效果";
|
||||
CLASSICAPI_NAME_SUGGESTIONS = "名称建议";
|
||||
CLASSICAPI_NAMEPLATES = "姓名板";
|
||||
CLASSICAPI_NUMBERS = "数字";
|
||||
CLASSICAPI_OPTIONS_ABOUT = "ClassicAPI为游戏添加的功能设置。每个选项对应一项设置,修改后立即生效。";
|
||||
CLASSICAPI_OPTIONS_ABOUT = "ClassicAPI为游戏添加的功能设置。\n每个选项对应一项设置,修改后立即生效。";
|
||||
CLASSICAPI_OTHER_NAMEPLATE_ALPHA = "其他姓名板不透明度";
|
||||
CLASSICAPI_OTHER_NAMEPLATE_ALPHA_TOOLTIP = "非目标单位姓名板的不透明度。";
|
||||
CLASSICAPI_PREFER_YOUR_TARGET = "优先你的目标";
|
||||
@@ -87,7 +87,7 @@ CLASSICAPI_RECENT_WHISPERS_FIRST_TOOLTIP = "名称建议从你最近密语过的
|
||||
CLASSICAPI_REMEMBER_PLAYERS = "记住玩家";
|
||||
CLASSICAPI_REMEMBER_PLAYERS_TOOLTIP = "保存你遇到的玩家的名字、职业、种族和性别,以便插件在以后的游戏中显示。你在该服务器的所有角色共享这些数据。";
|
||||
CLASSICAPI_SCRIPT_PROFILE = "脚本性能分析";
|
||||
CLASSICAPI_SCRIPT_PROFILE_TOOLTIP = "统计插件占用的CPU时间。更改将在你重载界面后生效。";
|
||||
CLASSICAPI_SCRIPT_PROFILE_TOOLTIP = "统计插件占用的CPU时间。更改将在你重载界面后生效。使用 /profiler help 命令查看说明";
|
||||
CLASSICAPI_SEPARATE_LARGE_NUMBERS = "分隔大数字";
|
||||
CLASSICAPI_SEPARATE_LARGE_NUMBERS_TOOLTIP = "当插件使用BreakUpLargeNumbers格式化数字时,每三位数字之间添加分隔符,例如1,234,567。";
|
||||
CLASSICAPI_SORT_BAGS_RIGHT_TO_LEFT = "从右到左整理背包";
|
||||
@@ -178,13 +178,18 @@ ITEM_SLOTS_IGNORED = "忽略%d个栏位";
|
||||
ITEM_MISSING = "%s缺失";
|
||||
ITEMS_NOT_IN_INVENTORY = "缺少%d件物品";
|
||||
STOP_AUTO_ATTACK = "停止自动攻击";
|
||||
SYMBOLIC_NEGATIVE_NUMBER = "-%s";
|
||||
SYMBOLIC_POSITIVE_NUMBER = "+%s";
|
||||
TARGETFOCUS = "选中焦点目标";
|
||||
COPPER_AMOUNT = "%d铜币";
|
||||
COPPER_AMOUNT_SYMBOL = "铜";
|
||||
COPPER_AMOUNT_TEXTURE = "%d|TInterface\\MoneyFrame\\UI-MoneyIcons:%d:%d:2:0:4:1:2:3:0:1|t";
|
||||
GEARSETS_POPUP_TEXT = "输入方案名称(最多16个字符):";
|
||||
GENERIC_FRACTION_STRING = "%d/%d";
|
||||
GOLD_AMOUNT = "%d金币";
|
||||
GOLD_AMOUNT_SYMBOL = "金";
|
||||
GOLD_AMOUNT_TEXTURE = "%d|TInterface\\MoneyFrame\\UI-MoneyIcons:%d:%d:2:0:4:1:0:1:0:1|t";
|
||||
GOLD_AMOUNT_TEXTURE_STRING = "%s|TInterface\\MoneyFrame\\UI-MoneyIcons:%d:%d:2:0:4:1:0:1:0:1|t";
|
||||
HOURS_MINUTES_SECONDS = "%.2d:%.2d:%.2d";
|
||||
ICON_FILTER_ALL = "所有图标";
|
||||
ICON_FILTER_ITEM = "物品";
|
||||
@@ -244,6 +249,7 @@ SET_FRIENDNOTE_LABEL = "为%s设置备注:";
|
||||
SET_NOTE = "设置备注";
|
||||
SILVER_AMOUNT = "%d银币";
|
||||
SILVER_AMOUNT_SYMBOL = "银";
|
||||
SILVER_AMOUNT_TEXTURE = "%d|TInterface\\MoneyFrame\\UI-MoneyIcons:%d:%d:2:0:4:1:1:2:0:1|t";
|
||||
SLASH_CANCELAURA1 = "/cancelaura";
|
||||
SLASH_CANCELAURA2 = "/cancelaura";
|
||||
SLASH_CANCELFORM1 = "/cancelform";
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
## Special Thanks: Iriel, Kirov, Esamynn
|
||||
## Version: DEV
|
||||
## LoadOnDemand: 1
|
||||
locales\locales.xml
|
||||
Dump.lua
|
||||
DebugTools.lua
|
||||
DebugTools.xml
|
||||
|
||||
@@ -146,7 +146,7 @@ end
|
||||
-- texture shows and its coordinates when they are not the whole image.
|
||||
local function _FormatTextureCoordinates(ulX, ulY, blX, blY, urX, urY, brX, brY)
|
||||
if (type(brY) ~= "number") then
|
||||
return "invalid coordinates";
|
||||
return TI_INVALID_COORDS;
|
||||
end
|
||||
if (ulX == 0 and ulY == 0 and blX == 0 and blY == 1 and
|
||||
urX == 1 and urY == 0 and brX == 1 and brY == 1) then
|
||||
@@ -164,7 +164,7 @@ local function _FormatTextureInfo(region)
|
||||
if (file == nil) then
|
||||
return nil;
|
||||
end
|
||||
return string.format("%s : %s: %s %s", region:GetDebugName(), _WrapColor("File", "ffff0000"),
|
||||
return string.format("%s : %s: %s %s", region:GetDebugName(), _WrapColor(TI_FILE_LABEL, "ffff0000"),
|
||||
tostring(file), _FormatTextureCoordinates(region:GetTexCoord()));
|
||||
end
|
||||
|
||||
@@ -203,7 +203,7 @@ function FrameStackTooltip_OnTooltipSetFrameStack(self, highlightFrame)
|
||||
end
|
||||
|
||||
if (fsobj) then
|
||||
self:AddLine(string.format("\nfsobj = %s", fsobj:GetDebugName()));
|
||||
self:AddLine(string.format("\n" .. FS_FSOBJ_LABEL, fsobj:GetDebugName()));
|
||||
end
|
||||
|
||||
ns.AddFrameStackLines(self, self.highlightFrame);
|
||||
|
||||
@@ -9,49 +9,49 @@ local function Profiled(fn)
|
||||
end
|
||||
end
|
||||
|
||||
local tab = ns.AddTab("Addons")
|
||||
local tab = ns.AddTab("Addons", PROFILER_TAB_ADDONS)
|
||||
|
||||
tab.list = ns.CreateList(tab.frame, {
|
||||
sort = 3,
|
||||
columns = {
|
||||
{
|
||||
title = "Addon",
|
||||
title = PROFILER_ADDONS_COL_ADDON,
|
||||
text = function(addon) return addon.title end,
|
||||
value = function(addon) return strlower(addon.name) end,
|
||||
},
|
||||
{
|
||||
title = "Memory", width = 70,
|
||||
tip = "The Lua memory that the addon's objects use now.",
|
||||
title = PROFILER_ADDONS_COL_MEMORY, width = 70,
|
||||
tip = PROFILER_ADDONS_TIP_MEMORY,
|
||||
text = function(addon) return ns.KB(addon.mem) end,
|
||||
value = function(addon) return addon.mem end,
|
||||
},
|
||||
{
|
||||
title = "Alloc/s", width = 76,
|
||||
tip = "The Lua memory the addon allocated in the last second. Allocations become garbage that the collector must free. A second with a garbage collection keeps the previous value.",
|
||||
title = PROFILER_ADDONS_COL_ALLOC_S, width = 76,
|
||||
tip = PROFILER_ADDONS_TIP_ALLOC_S,
|
||||
text = function(addon) return ns.KBRate(addon.memRate) end,
|
||||
value = function(addon) return addon.memRate end,
|
||||
},
|
||||
{
|
||||
title = "Peak/s", width = 76,
|
||||
tip = "The highest Alloc/s since the last reset.",
|
||||
title = PROFILER_ADDONS_COL_PEAK_S, width = 76,
|
||||
tip = PROFILER_ADDONS_TIP_PEAK_S,
|
||||
text = function(addon) return ns.KBRate(addon.peakRate) end,
|
||||
value = function(addon) return addon.peakRate end,
|
||||
},
|
||||
{
|
||||
title = "CPU/s", width = 64,
|
||||
tip = "The CPU time of the addon's own functions in the last second. Needs CPU profiling.",
|
||||
title = PROFILER_ADDONS_COL_CPU_S, width = 64,
|
||||
tip = PROFILER_ADDONS_TIP_CPU_S,
|
||||
text = Profiled(function(addon) return ns.MS(addon.cpuRate) end),
|
||||
value = Profiled(function(addon) return addon.cpuRate end),
|
||||
},
|
||||
{
|
||||
title = "CPU %", width = 50,
|
||||
tip = "The addon's share of the CPU time of all addons in the last second.",
|
||||
title = PROFILER_ADDONS_COL_CPU_PCT, width = 50,
|
||||
tip = PROFILER_ADDONS_TIP_CPU_PCT,
|
||||
text = Profiled(function(addon) return addon.cpuShare and format("%.1f%%", addon.cpuShare) end),
|
||||
value = Profiled(function(addon) return addon.cpuShare end),
|
||||
},
|
||||
{
|
||||
title = "CPU Total", width = 70,
|
||||
tip = "The CPU time of the addon's own functions since the last reset.",
|
||||
title = PROFILER_ADDONS_COL_CPU_TOTAL, width = 70,
|
||||
tip = PROFILER_ADDONS_TIP_CPU_TOTAL,
|
||||
text = Profiled(function(addon) return ns.MS(addon.cpu) end),
|
||||
value = Profiled(function(addon) return addon.cpu end),
|
||||
},
|
||||
@@ -61,17 +61,17 @@ tab.list = ns.CreateList(tab.frame, {
|
||||
GameTooltip:AddLine(addon.title)
|
||||
GameTooltip:AddLine(addon.name, .6, .6, .6)
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddDoubleLine("Memory", ns.KB(addon.mem), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine("Allocated per second", ns.KBRate(addon.memRate), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine("Peak per second", ns.KBRate(addon.peakRate), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine(PROFILER_ADDONS_TT_MEMORY, ns.KB(addon.mem), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine(PROFILER_ADDONS_TT_ALLOCATED_S, ns.KBRate(addon.memRate), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine(PROFILER_ADDONS_TT_PEAK_S, ns.KBRate(addon.peakRate), 1, 1, 1, 1, 1, 1)
|
||||
if ns.profiling then
|
||||
GameTooltip:AddDoubleLine("CPU per second", ns.MS(addon.cpuRate), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine("CPU since reset", ns.MS(addon.cpu), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine(PROFILER_ADDONS_TT_CPU_S, ns.MS(addon.cpuRate), 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddDoubleLine(PROFILER_ADDONS_TT_CPU_RESET, ns.MS(addon.cpu), 1, 1, 1, 1, 1, 1)
|
||||
else
|
||||
GameTooltip:AddLine("Turn on CPU profiling to see CPU times.", .6, .6, .6)
|
||||
GameTooltip:AddLine(PROFILER_LABEL_TURN_ON_PROFILING, .6, .6, .6)
|
||||
end
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine("Click: show its frames. Right-click: more.", .6, .6, .6)
|
||||
GameTooltip:AddLine(PROFILER_LABEL_CLICK_SHOW_FRAMES, .6, .6, .6)
|
||||
end,
|
||||
|
||||
click = function(addon)
|
||||
@@ -80,9 +80,9 @@ tab.list = ns.CreateList(tab.frame, {
|
||||
|
||||
menu = function(addon, root)
|
||||
root:CreateTitle(addon.name)
|
||||
root:CreateButton("Show frames", function() ns.ShowIn("Frames", addon.name) end)
|
||||
root:CreateButton("Show globals", function() ns.ShowIn("Globals", addon.name) end)
|
||||
root:CreateButton("Copy name", function() ns.Copy(addon.name) end)
|
||||
root:CreateButton(PROFILER_ADDONS_MENU_SHOW_FRAMES, function() ns.ShowIn("Frames", addon.name) end)
|
||||
root:CreateButton(PROFILER_ADDONS_MENU_SHOW_GLOBALS, function() ns.ShowIn("Globals", addon.name) end)
|
||||
root:CreateButton(PROFILER_ADDONS_MENU_COPY_NAME, function() ns.Copy(addon.name) end)
|
||||
end,
|
||||
})
|
||||
tab.list:SetAllPoints()
|
||||
@@ -96,9 +96,9 @@ function tab:OnSample()
|
||||
end
|
||||
|
||||
function tab:Status()
|
||||
local text = format("%d addons Lua %s / %s", #stats.list, ns.KB(stats.mem or 0), ns.KB(stats.threshold or 0))
|
||||
local text = format(PROFILER_ADDONS_STATUS, #stats.list, ns.KB(stats.mem or 0), ns.KB(stats.threshold or 0))
|
||||
if ns.profiling and stats.scriptRate then
|
||||
text = text .. format(" scripts %s/s events %s/s (%.0f fired/s)",
|
||||
text = text .. format(PROFILER_ADDONS_STATUS_SCRIPTS,
|
||||
ns.MS(stats.scriptRate), ns.MS(stats.eventRate), stats.eventCountRate)
|
||||
end
|
||||
return text
|
||||
|
||||
@@ -54,7 +54,7 @@ ns.WHITE = "|cffffffff"
|
||||
ns.RED = "|cffff5555"
|
||||
|
||||
function ns.Print(msg)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(ns.ACCENT .. "Profiler|r: " .. msg)
|
||||
DEFAULT_CHAT_FRAME:AddMessage(ns.ACCENT .. PROFILER_TITLE .. "|r: " .. msg)
|
||||
end
|
||||
|
||||
function ns.KB(kb)
|
||||
@@ -271,13 +271,13 @@ function ClassicAPIProfiler_HandleSlashCmd(msg)
|
||||
ns.widget:SetShown(not ns.widget:IsShown())
|
||||
elseif cmd == "reset" then
|
||||
ns.Reset()
|
||||
ns.Print("CPU and allocation counters reset.")
|
||||
ns.Print(PROFILER_RESET_MSG)
|
||||
elseif cmd == "profile" and (arg == "on" or arg == "off") then
|
||||
ns.SetProfiling(arg == "on")
|
||||
else
|
||||
ns.Print("/profiler - toggle the analyzer")
|
||||
ns.Print("/profiler widget - toggle the memory widget")
|
||||
ns.Print("/profiler reset - reset CPU and allocation counters")
|
||||
ns.Print("/profiler profile on|off - CPU profiling (reloads the UI)")
|
||||
ns.Print(PROFILER_SLASH_1)
|
||||
ns.Print(PROFILER_SLASH_2)
|
||||
ns.Print(PROFILER_SLASH_3)
|
||||
ns.Print(PROFILER_SLASH_4)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,11 +16,11 @@ end
|
||||
|
||||
local function Tooltip(ev)
|
||||
GameTooltip:AddLine(ev.name)
|
||||
Line("Fired", ns.Count(ev.fires) .. ns.GREY .. " (" .. format("%.1f", ev.fireRate or 0) .. "/s)")
|
||||
Line(PROFILER_LABEL_FIRED, ns.Count(ev.fires) .. ns.GREY .. " (" .. format("%.1f", ev.fireRate or 0) .. "/s)")
|
||||
if track.deep then
|
||||
Line("Handlers ran", ns.Count(ev.dispatches))
|
||||
if ns.profiling then Line("Handler CPU", ns.MS(ev.cpu)) end
|
||||
Line("Allocated", ns.KB(ev.alloc))
|
||||
Line(PROFILER_LABEL_HANDLERS_RAN, ns.Count(ev.dispatches))
|
||||
if ns.profiling then Line(PROFILER_LABEL_HANDLER_CPU, ns.MS(ev.cpu)) end
|
||||
Line(PROFILER_LABEL_ALLOCATED, ns.KB(ev.alloc))
|
||||
end
|
||||
|
||||
local listeners = {}
|
||||
@@ -38,7 +38,7 @@ local function Tooltip(ev)
|
||||
end)
|
||||
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine("Listeners", 1, .8, 0)
|
||||
GameTooltip:AddLine(PROFILER_LABEL_LISTENERS, 1, .8, 0)
|
||||
for i = 1, min(#listeners, 15) do
|
||||
local frame, stat = listeners[i].frame, listeners[i].stat
|
||||
local text = ns.GREY .. ns.OwnerLabel(ns.Owner(frame:GetScript("OnEvent") or frame))
|
||||
@@ -49,47 +49,47 @@ local function Tooltip(ev)
|
||||
Line(ns.FrameName(frame), text)
|
||||
end
|
||||
if #listeners > 15 then
|
||||
GameTooltip:AddLine("and " .. (#listeners - 15) .. " more", .6, .6, .6)
|
||||
GameTooltip:AddLine(format(PROFILER_MORE_LISTENERS, #listeners - 15), .6, .6, .6)
|
||||
end
|
||||
end
|
||||
|
||||
local tab = ns.AddTab("Events")
|
||||
local tab = ns.AddTab("Events", PROFILER_TAB_EVENTS)
|
||||
|
||||
tab.list = ns.CreateList(tab.frame, {
|
||||
sort = 2,
|
||||
columns = {
|
||||
{
|
||||
title = "Event",
|
||||
title = PROFILER_EVENTS_COL_EVENT,
|
||||
text = function(ev) return ev.name end,
|
||||
value = function(ev) return ev.search end,
|
||||
},
|
||||
{
|
||||
title = "Fires/s", width = 60,
|
||||
tip = "How often the event fired in the last second.",
|
||||
title = PROFILER_EVENTS_COL_FIRES_S, width = 60,
|
||||
tip = PROFILER_EVENTS_TIP_FIRES_S,
|
||||
text = function(ev) return ev.fireRate and format("%.1f", ev.fireRate) end,
|
||||
value = function(ev) return ev.fireRate end,
|
||||
},
|
||||
{
|
||||
title = "Listeners", width = 60,
|
||||
tip = "The frames registered for the event.",
|
||||
title = PROFILER_EVENTS_COL_LISTENERS, width = 60,
|
||||
tip = PROFILER_EVENTS_TIP_LISTENERS,
|
||||
text = function(ev) return ev.listeners end,
|
||||
value = function(ev) return ev.listeners end,
|
||||
},
|
||||
{
|
||||
title = "CPU/s", width = 64,
|
||||
tip = "The CPU time of the event's OnEvent handlers in the last second. Needs deep tracking and CPU profiling.",
|
||||
title = PROFILER_EVENTS_COL_CPU_S, width = 64,
|
||||
tip = PROFILER_EVENTS_TIP_CPU_S,
|
||||
text = Tracked(function(ev) return ns.profiling and ns.MS(ev.cpuRate) end),
|
||||
value = Tracked(function(ev) return ns.profiling and ev.cpuRate or nil end),
|
||||
},
|
||||
{
|
||||
title = "Alloc/s", width = 72,
|
||||
tip = "The Lua memory the event's OnEvent handlers allocated in the last second. Needs deep tracking.",
|
||||
title = PROFILER_EVENTS_COL_ALLOC_S, width = 72,
|
||||
tip = PROFILER_EVENTS_TIP_ALLOC_S,
|
||||
text = Tracked(function(ev) return ns.KBRate(ev.allocRate) end),
|
||||
value = Tracked(function(ev) return ev.allocRate end),
|
||||
},
|
||||
{
|
||||
title = "Fired", width = 64,
|
||||
tip = "How often the event fired since the analyzer opened or the last reset.",
|
||||
title = PROFILER_EVENTS_COL_FIRED, width = 64,
|
||||
tip = PROFILER_EVENTS_TIP_FIRED,
|
||||
text = function(ev) return ns.Count(ev.fires) end,
|
||||
value = function(ev) return ev.fires end,
|
||||
},
|
||||
@@ -99,7 +99,7 @@ tab.list = ns.CreateList(tab.frame, {
|
||||
|
||||
menu = function(ev, root)
|
||||
root:CreateTitle(ev.name)
|
||||
root:CreateButton("Copy name", function() ns.Copy(ev.name) end)
|
||||
root:CreateButton(PROFILER_EVENTS_MENU_COPY_NAME, function() ns.Copy(ev.name) end)
|
||||
end,
|
||||
})
|
||||
tab.list:SetAllPoints()
|
||||
@@ -116,9 +116,9 @@ tab.OnSample = Update
|
||||
function tab:Status()
|
||||
local fires = 0
|
||||
for _, ev in pairs(track.events) do fires = fires + (ev.fireRate or 0) end
|
||||
local text = format("%d events seen %.0f fired/s", #self.list.entries, fires)
|
||||
local text = format(PROFILER_EVENTS_STATUS, #self.list.entries, fires)
|
||||
if not track.deep then
|
||||
return text .. " " .. ns.GOLD .. "Turn on deep tracking for the CPU time and memory of each event."
|
||||
return text .. " " .. ns.GOLD .. PROFILER_EVENTS_STATUS_PROMPT
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ function ns.AddFrameStackLines(tooltip, region)
|
||||
local frame = region.GetScript and region or region:GetParent()
|
||||
|
||||
tooltip:AddLine(" ")
|
||||
Line(tooltip, "Owner", ns.OwnerLabel(ns.Owner(region)))
|
||||
Line(tooltip, PROFILER_LABEL_OWNER, ns.OwnerLabel(ns.Owner(region)))
|
||||
if not frame then return end
|
||||
|
||||
for _, script in ipairs({ "OnUpdate", "OnEvent" }) do
|
||||
@@ -21,7 +21,7 @@ function ns.AddFrameStackLines(tooltip, region)
|
||||
local text = ns.OwnerLabel(ns.Owner(fn))
|
||||
if ns.profiling then
|
||||
local ms, calls = GetFunctionCPUUsage(fn)
|
||||
text = text .. ns.GREY .. " " .. ns.MS(ms) .. " in " .. ns.Count(calls) .. " calls"
|
||||
text = text .. ns.GREY .. " " .. ns.MS(ms) .. format(PROFILER_CALLS_FORMAT, ns.Count(calls))
|
||||
end
|
||||
Line(tooltip, script, text)
|
||||
end
|
||||
@@ -29,11 +29,11 @@ function ns.AddFrameStackLines(tooltip, region)
|
||||
|
||||
if ns.profiling then
|
||||
local ms, calls = GetFrameCPUUsage(frame, false)
|
||||
Line(tooltip, "All scripts", ns.MS(ms) .. ns.GREY .. " in " .. ns.Count(calls) .. " calls")
|
||||
Line(tooltip, PROFILER_LABEL_ALL_SCRIPTS, ns.MS(ms) .. ns.GREY .. format(PROFILER_CALLS_FORMAT, ns.Count(calls)))
|
||||
end
|
||||
|
||||
local rec = ns.track.frames[frame]
|
||||
if rec and (rec.hookedUpdate or rec.hookedEvent) then
|
||||
Line(tooltip, "Allocated", ns.KB(rec.alloc) .. ns.GREY .. " (" .. ns.KBRate(rec.allocRate) .. ")")
|
||||
Line(tooltip, PROFILER_LABEL_ALLOCATED, ns.KB(rec.alloc) .. ns.GREY .. " (" .. ns.KBRate(rec.allocRate) .. ")")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,9 +34,10 @@ end
|
||||
local function Tooltip(rec)
|
||||
local frame = rec.frame
|
||||
GameTooltip:AddLine(rec.name)
|
||||
Line("Type", frame:GetObjectType())
|
||||
Line("Owner", ns.OwnerLabel(rec.owner))
|
||||
Line("State", frame:IsVisible() and "visible" or frame:IsShown() and "shown, parent hidden" or "hidden")
|
||||
Line(PROFILER_LABEL_TYPE, frame:GetObjectType())
|
||||
Line(PROFILER_LABEL_OWNER, ns.OwnerLabel(rec.owner))
|
||||
Line(PROFILER_LABEL_STATE, frame:IsVisible() and PROFILER_STATE_VISIBLE
|
||||
or frame:IsShown() and PROFILER_STATE_SHOWN_HIDDEN or PROFILER_STATE_HIDDEN)
|
||||
|
||||
local source = frame:GetSourceLocation()
|
||||
if source then
|
||||
@@ -50,23 +51,23 @@ local function Tooltip(rec)
|
||||
local text = ns.OwnerLabel(ns.Owner(fn))
|
||||
if ns.profiling then
|
||||
local ms, calls = GetFunctionCPUUsage(fn)
|
||||
text = text .. ns.GREY .. " " .. ns.MS(ms) .. " in " .. ns.Count(calls) .. " calls"
|
||||
text = text .. ns.GREY .. " " .. ns.MS(ms) .. format(PROFILER_CALLS_FORMAT, ns.Count(calls))
|
||||
end
|
||||
Line(script, text)
|
||||
end
|
||||
end
|
||||
|
||||
if ns.profiling then
|
||||
Line("All scripts", ns.MS(rec.cpu) .. " in " .. ns.Count(rec.calls) .. " calls")
|
||||
Line(PROFILER_LABEL_ALL_SCRIPTS, ns.MS(rec.cpu) .. format(PROFILER_CALLS_FORMAT, ns.Count(rec.calls)))
|
||||
end
|
||||
if rec.hookedUpdate or rec.hookedEvent then
|
||||
Line("Allocated", ns.KB(rec.alloc))
|
||||
Line(PROFILER_LABEL_ALLOCATED, ns.KB(rec.alloc))
|
||||
end
|
||||
|
||||
local events = SortedEvents(rec)
|
||||
if #events > 0 then
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine("Events", 1, .8, 0)
|
||||
GameTooltip:AddLine(PROFILER_LABEL_EVENTS, 1, .8, 0)
|
||||
for i = 1, min(#events, 12) do
|
||||
local stat = events[i].stat
|
||||
local text = ns.Count(stat.count) .. "x"
|
||||
@@ -76,52 +77,52 @@ local function Tooltip(rec)
|
||||
end
|
||||
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine("Right-click: highlight, inspect or copy.", .6, .6, .6)
|
||||
GameTooltip:AddLine(PROFILER_LABEL_RIGHT_CLICK_HINT, .6, .6, .6)
|
||||
end
|
||||
|
||||
local tab = ns.AddTab("Frames")
|
||||
local tab = ns.AddTab("Frames", PROFILER_TAB_FRAMES)
|
||||
|
||||
tab.list = ns.CreateList(tab.frame, {
|
||||
sort = 3,
|
||||
columns = {
|
||||
{
|
||||
title = "Frame",
|
||||
title = PROFILER_FRAMES_COL_FRAME,
|
||||
text = function(rec) return rec.name end,
|
||||
value = function(rec) return strlower(rec.name) end,
|
||||
},
|
||||
{
|
||||
title = "Owner", width = 100, justify = "LEFT",
|
||||
tip = "The addon that made the frame's OnUpdate or OnEvent handler, or the frame itself.",
|
||||
title = PROFILER_FRAMES_COL_OWNER, width = 100, justify = "LEFT",
|
||||
tip = PROFILER_FRAMES_TIP_OWNER,
|
||||
text = function(rec) return ns.OwnerLabel(rec.owner) end,
|
||||
value = function(rec) return strlower(ns.OwnerLabel(rec.owner)) end,
|
||||
},
|
||||
{
|
||||
title = "CPU/s", width = 64,
|
||||
tip = "The CPU time of all the frame's scripts in the last second. Needs CPU profiling.",
|
||||
title = PROFILER_FRAMES_COL_CPU_S, width = 64,
|
||||
tip = PROFILER_FRAMES_TIP_CPU_S,
|
||||
text = Profiled(function(rec) return ns.MS(rec.cpuRate) end),
|
||||
value = Profiled(function(rec) return rec.cpuRate end),
|
||||
},
|
||||
{
|
||||
title = "Calls/s", width = 60,
|
||||
tip = "How often the frame's scripts ran in the last second. Needs CPU profiling.",
|
||||
title = PROFILER_FRAMES_COL_CALLS_S, width = 60,
|
||||
tip = PROFILER_FRAMES_TIP_CALLS_S,
|
||||
text = Profiled(function(rec) return ns.Count(rec.callRate) end),
|
||||
value = Profiled(function(rec) return rec.callRate end),
|
||||
},
|
||||
{
|
||||
title = "Per Call", width = 64,
|
||||
tip = "The average CPU time of one script call since the last reset.",
|
||||
title = PROFILER_FRAMES_COL_PER_CALL, width = 64,
|
||||
tip = PROFILER_FRAMES_TIP_PER_CALL,
|
||||
text = Profiled(function(rec) return rec.calls > 0 and ns.MS(rec.cpu / rec.calls) end),
|
||||
value = Profiled(function(rec) return rec.calls > 0 and rec.cpu / rec.calls or nil end),
|
||||
},
|
||||
{
|
||||
title = "Alloc/s", width = 72,
|
||||
tip = "The Lua memory the frame's OnUpdate and OnEvent scripts allocated in the last second. Needs deep tracking.",
|
||||
title = PROFILER_FRAMES_COL_ALLOC_S, width = 72,
|
||||
tip = PROFILER_FRAMES_TIP_ALLOC_S,
|
||||
text = Tracked(function(rec) return ns.KBRate(rec.allocRate) end),
|
||||
value = Tracked(function(rec) return rec.allocRate end),
|
||||
},
|
||||
{
|
||||
title = "CPU Total", width = 64,
|
||||
tip = "The CPU time of all the frame's scripts since the last reset.",
|
||||
title = PROFILER_FRAMES_COL_CPU_TOTAL, width = 64,
|
||||
tip = PROFILER_FRAMES_TIP_CPU_TOTAL,
|
||||
text = Profiled(function(rec) return ns.MS(rec.cpu) end),
|
||||
value = Profiled(function(rec) return rec.cpu end),
|
||||
},
|
||||
@@ -131,14 +132,14 @@ tab.list = ns.CreateList(tab.frame, {
|
||||
|
||||
menu = function(rec, root)
|
||||
root:CreateTitle(rec.name)
|
||||
root:CreateButton("Highlight", function() ns.Highlight(rec.frame) end)
|
||||
root:CreateButton("Inspect", function() ns.Inspect(rec.frame) end)
|
||||
root:CreateButton("Copy name", function() ns.Copy(rec.name) end)
|
||||
root:CreateButton(PROFILER_FRAMES_MENU_HIGHLIGHT, function() ns.Highlight(rec.frame) end)
|
||||
root:CreateButton(PROFILER_FRAMES_MENU_INSPECT, function() ns.Inspect(rec.frame) end)
|
||||
root:CreateButton(PROFILER_FRAMES_MENU_COPY_NAME, function() ns.Copy(rec.name) end)
|
||||
local source = rec.frame:GetSourceLocation()
|
||||
if source then
|
||||
root:CreateButton("Copy source location", function() ns.Copy(source) end)
|
||||
root:CreateButton(PROFILER_FRAMES_MENU_COPY_SRC, function() ns.Copy(source) end)
|
||||
end
|
||||
root:CreateButton("Show " .. ns.OwnerLabel(rec.owner) .. " frames", function()
|
||||
root:CreateButton(format(PROFILER_FRAMES_MENU_SHOW_OWNER, ns.OwnerLabel(rec.owner)), function()
|
||||
ns.ShowIn("Frames", ns.OwnerLabel(rec.owner))
|
||||
end)
|
||||
end,
|
||||
@@ -157,10 +158,10 @@ tab.OnSelect = Update
|
||||
tab.OnSample = Update
|
||||
|
||||
function tab:Status()
|
||||
local text = format("%d frames %d listed", track.frameCount, #self.list.shown)
|
||||
local text = format(PROFILER_FRAMES_STATUS, track.frameCount, #self.list.shown)
|
||||
if not ns.profiling and not track.deep then
|
||||
return text .. " " .. ns.GOLD .. "Turn on CPU profiling or deep tracking to measure frames."
|
||||
return text .. " " .. ns.GOLD .. PROFILER_FRAMES_STATUS_PROMPT
|
||||
end
|
||||
if track.deep then text = text .. " deep tracking on" end
|
||||
if track.deep then text = text .. PROFILER_FRAMES_STATUS_DEEP end
|
||||
return text
|
||||
end
|
||||
|
||||
@@ -21,61 +21,61 @@ end
|
||||
local function Tooltip(entry)
|
||||
local value = entry.value
|
||||
GameTooltip:AddLine(entry.name)
|
||||
Line("Type", entry.kind)
|
||||
Line("Owner", ns.OwnerLabel(entry.owner))
|
||||
Line(PROFILER_LABEL_TYPE, entry.kind)
|
||||
Line(PROFILER_LABEL_OWNER, ns.OwnerLabel(entry.owner))
|
||||
if entry.override then
|
||||
GameTooltip:AddLine("Not ClassicAPI's function: something replaced or hooked it.", 1, .3, .3, true)
|
||||
GameTooltip:AddLine(PROFILER_LABEL_NOT_CLASSICAPI, 1, .3, .3, true)
|
||||
end
|
||||
|
||||
if entry.kind == "function" and ns.profiling then
|
||||
Line("CPU", ns.MS(entry.cpu))
|
||||
Line("Calls", ns.Count(entry.calls))
|
||||
if entry.calls > 0 then Line("Per call", ns.MS(entry.cpu / entry.calls)) end
|
||||
Line(PROFILER_LABEL_CPU, ns.MS(entry.cpu))
|
||||
Line(PROFILER_LABEL_CALLS, ns.Count(entry.calls))
|
||||
if entry.calls > 0 then Line(PROFILER_LABEL_PER_CALL, ns.MS(entry.cpu / entry.calls)) end
|
||||
elseif entry.kind == "table" then
|
||||
Line("Entries", ns.Count(table.count(value)))
|
||||
Line(PROFILER_LABEL_ENTRIES, ns.Count(table.count(value)))
|
||||
elseif type(value) == "table" then
|
||||
Line("Debug name", ns.FrameName(value))
|
||||
Line(PROFILER_LABEL_DEBUG_NAME, ns.FrameName(value))
|
||||
local source = value:GetSourceLocation()
|
||||
if source then GameTooltip:AddLine(source, .6, .6, .6, true) end
|
||||
elseif type(value) ~= "function" and value ~= nil then
|
||||
Line("Value", strsub(tostring(value), 1, 60))
|
||||
Line(PROFILER_LABEL_VALUE, strsub(tostring(value), 1, 60))
|
||||
end
|
||||
end
|
||||
|
||||
local tab = ns.AddTab("Globals")
|
||||
local tab = ns.AddTab("Globals", PROFILER_TAB_GLOBALS)
|
||||
tab.untagged = false
|
||||
|
||||
tab.list = ns.CreateList(tab.frame, {
|
||||
sort = 3,
|
||||
columns = {
|
||||
{
|
||||
title = "Name",
|
||||
title = PROFILER_GLOBALS_COL_NAME,
|
||||
text = function(entry)
|
||||
if entry.override then return ns.RED .. entry.name .. ns.GREY .. " (replaced)" end
|
||||
if entry.override then return ns.RED .. entry.name .. ns.GREY .. PROFILER_LABEL_REPLACED end
|
||||
return entry.name
|
||||
end,
|
||||
value = function(entry) return strlower(entry.name) end,
|
||||
},
|
||||
{
|
||||
title = "Type", width = 80, justify = "LEFT",
|
||||
title = PROFILER_GLOBALS_COL_TYPE, width = 80, justify = "LEFT",
|
||||
text = function(entry) return entry.kind end,
|
||||
value = function(entry) return entry.kind end,
|
||||
},
|
||||
{
|
||||
title = "Owner", width = 100, justify = "LEFT",
|
||||
tip = "The addon that made the value. Strings, numbers and booleans have no owner.",
|
||||
title = PROFILER_GLOBALS_COL_OWNER, width = 100, justify = "LEFT",
|
||||
tip = PROFILER_GLOBALS_TIP_OWNER,
|
||||
text = function(entry) return ns.OwnerLabel(entry.owner) end,
|
||||
value = function(entry) return strlower(ns.OwnerLabel(entry.owner)) end,
|
||||
},
|
||||
{
|
||||
title = "CPU", width = 64,
|
||||
tip = "The CPU time of the function since the last reset. Needs CPU profiling.",
|
||||
title = PROFILER_GLOBALS_COL_CPU, width = 64,
|
||||
tip = PROFILER_GLOBALS_TIP_CPU,
|
||||
text = function(entry) return entry.cpu and ns.MS(entry.cpu) end,
|
||||
value = function(entry) return entry.cpu end,
|
||||
},
|
||||
{
|
||||
title = "Calls", width = 70,
|
||||
tip = "How often the function ran since the last reset. Needs CPU profiling.",
|
||||
title = PROFILER_GLOBALS_COL_CALLS, width = 70,
|
||||
tip = PROFILER_GLOBALS_TIP_CALLS,
|
||||
text = function(entry) return entry.calls and ns.Count(entry.calls) end,
|
||||
value = function(entry) return entry.calls end,
|
||||
},
|
||||
@@ -87,12 +87,12 @@ tab.list = ns.CreateList(tab.frame, {
|
||||
local value = entry.value
|
||||
root:CreateTitle(entry.name)
|
||||
if type(value) == "table" then
|
||||
root:CreateButton("Inspect", function() ns.Inspect(value) end)
|
||||
root:CreateButton(PROFILER_GLOBALS_MENU_INSPECT, function() ns.Inspect(value) end)
|
||||
if entry.kind ~= "table" then
|
||||
root:CreateButton("Highlight", function() ns.Highlight(value) end)
|
||||
root:CreateButton(PROFILER_GLOBALS_MENU_HIGHLIGHT, function() ns.Highlight(value) end)
|
||||
end
|
||||
end
|
||||
root:CreateButton("Copy name", function() ns.Copy(entry.name) end)
|
||||
root:CreateButton(PROFILER_GLOBALS_MENU_COPY_NAME, function() ns.Copy(entry.name) end)
|
||||
end,
|
||||
})
|
||||
tab.list:SetPoint("TOPLEFT", 0, -26)
|
||||
@@ -153,19 +153,19 @@ local function Scan()
|
||||
tab.list:SetEntries(entries)
|
||||
end
|
||||
|
||||
local rescan = ns.CreateButton("ClassicAPIProfilerWindowRescan", tab.frame, 80, "Rescan", Scan)
|
||||
local rescan = ns.CreateButton("ClassicAPIProfilerWindowRescan", tab.frame, 80, PROFILER_GLOBALS_RESCAN, Scan)
|
||||
rescan:SetPoint("TOPRIGHT", -4, -2)
|
||||
ns.Tooltip(rescan, "Read the global namespace again. Also updates the CPU times.")
|
||||
ns.Tooltip(rescan, PROFILER_GLOBALS_RESCAN_TIP)
|
||||
|
||||
local untagged = CreateFrame("CheckButton", "ClassicAPIProfilerWindowUntagged", tab.frame, "UICheckButtonTemplate")
|
||||
untagged:SetSize(20, 20)
|
||||
untagged:SetPoint("RIGHT", rescan, "LEFT", -110, 0)
|
||||
ClassicAPIProfilerWindowUntaggedText:SetText("Show FrameXML")
|
||||
ClassicAPIProfilerWindowUntaggedText:SetText(PROFILER_GLOBALS_SHOW_FRAMEXML)
|
||||
untagged:SetScript("OnClick", function(self)
|
||||
tab.untagged = self:GetChecked() and true or false
|
||||
Scan()
|
||||
end)
|
||||
ns.Tooltip(untagged, "Also list the values the game's own code made, and plain strings, numbers and booleans. With CPU profiling this shows the cost of every game API function.")
|
||||
ns.Tooltip(untagged, PROFILER_GLOBALS_SHOW_FRAMEXML_TIP)
|
||||
|
||||
function tab:OnSelect()
|
||||
if not self.count then Scan() end
|
||||
@@ -173,5 +173,5 @@ end
|
||||
|
||||
function tab:Status()
|
||||
if not self.count then return "" end
|
||||
return format("%d globals listed %d ClassicAPI functions replaced or hooked", #self.list.shown, self.overrides)
|
||||
return format(PROFILER_GLOBALS_STATUS, #self.list.shown, self.overrides)
|
||||
end
|
||||
|
||||
@@ -33,13 +33,13 @@ local function AddLine(label)
|
||||
return right
|
||||
end
|
||||
|
||||
local memory = AddLine("Memory")
|
||||
local rate = AddLine("Rate")
|
||||
local cleanup = AddLine("Last Cleanup")
|
||||
local framerate = AddLine("Framerate")
|
||||
local cpu = AddLine("Lua CPU")
|
||||
local topMem = AddLine("Top Alloc")
|
||||
local topCpu = AddLine("Top CPU")
|
||||
local memory = AddLine(PROFILER_WIDGET_MEMORY)
|
||||
local rate = AddLine(PROFILER_WIDGET_RATE)
|
||||
local cleanup = AddLine(PROFILER_WIDGET_LAST_CLEANUP)
|
||||
local framerate = AddLine(PROFILER_WIDGET_FRAMERATE)
|
||||
local cpu = AddLine(PROFILER_WIDGET_LUA_CPU)
|
||||
local topMem = AddLine(PROFILER_WIDGET_TOP_ALLOC)
|
||||
local topCpu = AddLine(PROFILER_WIDGET_TOP_CPU)
|
||||
|
||||
-- the largest allocation in a tenth of a second, draining over 5 seconds
|
||||
local DRAIN = .1 / 5
|
||||
@@ -74,7 +74,7 @@ widget:SetScript("OnUpdate", function(self, elapsed)
|
||||
if grown > value then
|
||||
bar:SetMinMaxValues(0, grown)
|
||||
bar:SetValue(grown)
|
||||
barText:SetText(ns.ACCENT .. "Last Peak (100ms):|r " .. grown .. ns.GREY .. " KB")
|
||||
barText:SetText(ns.ACCENT .. PROFILER_WIDGET_LAST_PEAK .. grown .. ns.GREY .. " KB")
|
||||
else
|
||||
bar:SetValue(max(value - peak * DRAIN, 0))
|
||||
end
|
||||
@@ -91,7 +91,7 @@ ns.OnSample(function()
|
||||
memory:SetText(ns.WHITE .. ns.KB(stats.mem) .. ns.GREY .. " / " .. ns.WHITE .. ns.KB(stats.threshold))
|
||||
|
||||
if stats.collected then
|
||||
rate:SetText(ns.ACCENT .. "collected " .. ns.KB(gc.freed or 0))
|
||||
rate:SetText(ns.ACCENT .. PROFILER_WIDGET_COLLECTED .. ns.KB(gc.freed or 0))
|
||||
elseif stats.memRate then
|
||||
rate:SetText(ns.WHITE .. ns.KBRate(stats.memRate))
|
||||
end
|
||||
@@ -99,7 +99,7 @@ ns.OnSample(function()
|
||||
if gc.time then
|
||||
cleanup:SetText(ns.WHITE .. gc.clock .. ns.GREY .. " (" .. SecondsToTime(GetTime() - gc.time) .. " ago)")
|
||||
else
|
||||
cleanup:SetText(ns.GREY .. "none yet")
|
||||
cleanup:SetText(ns.GREY .. PROFILER_WIDGET_NONE_YET)
|
||||
end
|
||||
|
||||
local fps = GetFramerate()
|
||||
@@ -109,7 +109,7 @@ ns.OnSample(function()
|
||||
cpu:SetText(ns.WHITE .. ns.MS(stats.scriptRate) .. ns.GREY .. "/s (" .. ns.WHITE .. format("%.1f%%", stats.scriptRate / 10) .. ns.GREY .. ")")
|
||||
topCpu:SetText(stats.topCpu and ns.WHITE .. stats.topCpu.name .. " " .. ns.GREY .. ns.MS(stats.topCpu.cpuRate) .. "/s" or "")
|
||||
else
|
||||
cpu:SetText(ns.GREY .. "profiling off")
|
||||
cpu:SetText(ns.GREY .. PROFILER_WIDGET_PROFILING_OFF)
|
||||
topCpu:SetText(ns.GREY .. "-")
|
||||
end
|
||||
|
||||
@@ -141,26 +141,26 @@ end
|
||||
widget:SetScript("OnEnter", function(self)
|
||||
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT")
|
||||
GameTooltip:ClearLines()
|
||||
GameTooltip:AddLine(ns.ACCENT .. "Profiler")
|
||||
GameTooltip:AddLine(ns.ACCENT .. PROFILER_WIDGET_TT_TITLE)
|
||||
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine("Allocated per second", 1, .8, 0)
|
||||
GameTooltip:AddLine(PROFILER_WIDGET_ALLOC_PER_SEC, 1, .8, 0)
|
||||
for _, addon in ipairs(Top("memRate", 8)) do
|
||||
GameTooltip:AddDoubleLine(addon.name, ns.KBRate(addon.memRate), 1, 1, 1, 1, 1, 1)
|
||||
end
|
||||
|
||||
if ns.profiling then
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine("CPU per second", 1, .8, 0)
|
||||
GameTooltip:AddLine(PROFILER_WIDGET_CPU_PER_SEC, 1, .8, 0)
|
||||
for _, addon in ipairs(Top("cpuRate", 8)) do
|
||||
GameTooltip:AddDoubleLine(addon.name, ns.MS(addon.cpuRate), 1, 1, 1, 1, 1, 1)
|
||||
end
|
||||
end
|
||||
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine("Left-click: reset the peak", .6, .6, .6)
|
||||
GameTooltip:AddLine("Right-click: open the analyzer", .6, .6, .6)
|
||||
GameTooltip:AddLine("Drag: move", .6, .6, .6)
|
||||
GameTooltip:AddLine(PROFILER_WIDGET_LEFT_CLICK, .6, .6, .6)
|
||||
GameTooltip:AddLine(PROFILER_WIDGET_RIGHT_CLICK, .6, .6, .6)
|
||||
GameTooltip:AddLine(PROFILER_WIDGET_DRAG, .6, .6, .6)
|
||||
GameTooltip:Show()
|
||||
end)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ tinsert(UISpecialFrames, "ClassicAPIProfilerWindow")
|
||||
local title = window:CreateFontString(nil, "OVERLAY", "GameFontWhite")
|
||||
title:SetFont(STANDARD_TEXT_FONT, 14)
|
||||
title:SetPoint("TOPLEFT", 10, -10)
|
||||
title:SetText(ns.ACCENT .. "Profiler|r: " .. ns.GOLD .. "Analyzer")
|
||||
title:SetText(ns.ACCENT .. PROFILER_TITLE .. "|r: " .. ns.GOLD .. PROFILER_ANALYZER)
|
||||
|
||||
local close = CreateFrame("Button", "ClassicAPIProfilerWindowClose", window, "UIPanelCloseButton")
|
||||
close:SetSize(20, 20)
|
||||
@@ -59,7 +59,7 @@ end
|
||||
-- [[ actions the tabs offer in their context menus ]]
|
||||
function ns.Copy(text)
|
||||
local bytes = CopyToClipboard(text, true)
|
||||
ns.Print("Copied " .. bytes .. " bytes to the clipboard.")
|
||||
ns.Print(format(PROFILER_COPIED, bytes))
|
||||
end
|
||||
|
||||
function ns.Inspect(value)
|
||||
@@ -75,7 +75,7 @@ highlight:Hide()
|
||||
|
||||
function ns.Highlight(frame)
|
||||
if not frame:IsVisible() then
|
||||
ns.Print(ns.FrameName(frame) .. " is hidden.")
|
||||
ns.Print(format(PROFILER_FRAME_HIDDEN, ns.FrameName(frame)))
|
||||
return
|
||||
end
|
||||
highlight:ClearAllPoints()
|
||||
@@ -301,7 +301,9 @@ function ns.SelectTab(tab)
|
||||
UpdateStatus()
|
||||
end
|
||||
|
||||
function ns.AddTab(name)
|
||||
-- `name` is the stable key ns.ShowIn looks the tab up by; `label` is the
|
||||
-- localized button text
|
||||
function ns.AddTab(name, label)
|
||||
local tab = { name = name }
|
||||
local index = #tabs + 1
|
||||
|
||||
@@ -310,7 +312,7 @@ function ns.AddTab(name)
|
||||
tab.frame:SetPoint("BOTTOMRIGHT", -6, 24)
|
||||
tab.frame:Hide()
|
||||
|
||||
tab.button = ns.CreateButton("ClassicAPIProfilerWindowTab" .. index, window, 90, name, function() ns.SelectTab(tab) end)
|
||||
tab.button = ns.CreateButton("ClassicAPIProfilerWindowTab" .. index, window, 90, label, function() ns.SelectTab(tab) end)
|
||||
tab.button:SetPoint("TOPLEFT", 8 + (index - 1) * 94, -32)
|
||||
|
||||
tabs[index] = tab
|
||||
@@ -338,38 +340,37 @@ end)
|
||||
|
||||
search.placeholder = search:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
||||
search.placeholder:SetPoint("LEFT", 2, 0)
|
||||
search.placeholder:SetText("Search name, owner or source")
|
||||
search.placeholder:SetText(PROFILER_SEARCH_PLACEHOLDER)
|
||||
|
||||
local copy = ns.CreateButton("ClassicAPIProfilerWindowCopy", window, 70, "Copy", function()
|
||||
local copy = ns.CreateButton("ClassicAPIProfilerWindowCopy", window, 70, PROFILER_COPY, function()
|
||||
ns.Copy(window.active.list:Export())
|
||||
end)
|
||||
copy:SetPoint("TOPRIGHT", -8, -58)
|
||||
Tooltip(copy, "Copy the shown rows to the clipboard as plain text.")
|
||||
Tooltip(copy, PROFILER_COPY_TIP)
|
||||
|
||||
local reset = ns.CreateButton("ClassicAPIProfilerWindowReset", window, 70, "Reset", function()
|
||||
local reset = ns.CreateButton("ClassicAPIProfilerWindowReset", window, 70, PROFILER_RESET, function()
|
||||
ns.Reset()
|
||||
UpdateStatus()
|
||||
end)
|
||||
reset:SetPoint("RIGHT", copy, "LEFT", -4, 0)
|
||||
Tooltip(reset, "Set every CPU time, call count, allocation and event count to zero.")
|
||||
Tooltip(reset, PROFILER_RESET_TIP)
|
||||
|
||||
local deep = ns.CreateButton("ClassicAPIProfilerWindowDeep", window, 150, "", function(self)
|
||||
ns.track.EnableDeep()
|
||||
self:SetText("Deep Tracking: " .. ns.ACCENT .. "ON")
|
||||
self:SetText(PROFILER_DEEP_TRACKING .. ns.ACCENT .. PROFILER_ON)
|
||||
self:Disable()
|
||||
end)
|
||||
deep:SetPoint("RIGHT", reset, "LEFT", -4, 0)
|
||||
deep:SetText("Deep Tracking: " .. ns.GREY .. "OFF")
|
||||
Tooltip(deep, "Hooks the OnUpdate and OnEvent scripts of every frame to measure the Lua memory each frame allocates, and the CPU time and memory of each event. The hooks never replace a handler, but they add a little time to every script call. They stay until /reload.")
|
||||
deep:SetText(PROFILER_DEEP_TRACKING .. ns.GREY .. PROFILER_OFF)
|
||||
Tooltip(deep, PROFILER_DEEP_TRACKING_TIP)
|
||||
|
||||
local profiling = ns.CreateButton("ClassicAPIProfilerWindowProfiling", window, 150, "", function()
|
||||
ns.SetProfiling(not ns.profiling)
|
||||
end)
|
||||
profiling:SetPoint("TOPRIGHT", -24, -32)
|
||||
profiling:SetText("CPU Profiling: " .. (ns.profiling and ns.ACCENT .. "ON" or ns.GREY .. "OFF"))
|
||||
profiling:SetText(PROFILER_CPU_PROFILING .. (ns.profiling and ns.ACCENT .. PROFILER_ON or ns.GREY .. PROFILER_OFF))
|
||||
Tooltip(profiling, function()
|
||||
return (ns.profiling and "Turn CPU profiling off" or "Turn CPU profiling on") ..
|
||||
" and reload the UI.\n\nProfiling measures the CPU time of every addon, frame, function and event. It makes each Lua call slower, so turn it off when you are done."
|
||||
return (ns.profiling and PROFILER_CPU_PROFILING_TIP_ON or PROFILER_CPU_PROFILING_TIP_OFF) .. PROFILER_CPU_PROFILING_TIP_BODY
|
||||
end)
|
||||
|
||||
-- [[ sampling while open ]]
|
||||
|
||||
@@ -213,7 +213,7 @@ function TableInspectorMixin:InspectTable(focusedTable, title)
|
||||
self.focusedTable = focusedTable;
|
||||
if not focusedTable then
|
||||
self:ClearData();
|
||||
self.TitleButton.Text:SetText("No Table Selected");
|
||||
self.TitleButton.Text:SetText(TI_NO_TABLE_SELECTED);
|
||||
return;
|
||||
end
|
||||
|
||||
@@ -230,9 +230,9 @@ function TableInspectorMixin:InspectTable(focusedTable, title)
|
||||
|
||||
if not title then
|
||||
if focusedTable.GetDebugName then
|
||||
title = "Frame Attributes - "..focusedTable:GetDebugName();
|
||||
title = TI_FRAME_ATTRIBUTES..focusedTable:GetDebugName();
|
||||
else
|
||||
title = "Table Attributes";
|
||||
title = TI_TABLE_ATTRIBUTES;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString parentKey="Label" inherits="GameFontWhite" text="Show">
|
||||
<FontString parentKey="Label" inherits="GameFontWhite" text="TI_SHOW">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativePoint="RIGHT"/>
|
||||
</Anchors>
|
||||
@@ -199,7 +199,7 @@
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString parentKey="Label" inherits="GameFontWhite" text="Highlight">
|
||||
<FontString parentKey="Label" inherits="GameFontWhite" text="TI_HIGHLIGHT">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativePoint="RIGHT"/>
|
||||
</Anchors>
|
||||
@@ -222,7 +222,7 @@
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString parentKey="Label" inherits="GameFontWhite" text="Dynamic Updates">
|
||||
<FontString parentKey="Label" inherits="GameFontWhite" text="TI_DYNAMIC_UPDATES">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativePoint="RIGHT"/>
|
||||
</Anchors>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<Size x="400" y="16"/>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString parentKey="Text" inherits="GameFontNormalLarge" justifyH="LEFT" text="anchor(s)">
|
||||
<FontString parentKey="Text" inherits="GameFontNormalLarge" justifyH="LEFT" text="TI_ANCHORS_TITLE">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" x="12" y="0"/>
|
||||
</Anchors>
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- ClassicAPI_DebugTools: English defaults.
|
||||
-- Every string that appears in zhCN.lua must have a default here so that
|
||||
-- other locales (or the game running in English) still work.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- [[ FrameStack / /fstack / texture info (DebugTools.lua) ]]
|
||||
TI_INVALID_COORDS = "invalid coordinates"
|
||||
TI_FILE_LABEL = "File"
|
||||
FS_FSOBJ_LABEL = "fsobj = %s"
|
||||
|
||||
-- [[ Table Inspector main window (TableInspector.lua + .xml) ]]
|
||||
TI_NO_TABLE_SELECTED = "No Table Selected"
|
||||
TI_FRAME_ATTRIBUTES = "Frame Attributes - "
|
||||
TI_TABLE_ATTRIBUTES = "Table Attributes"
|
||||
|
||||
TI_SHOW = "Show"
|
||||
TI_HIGHLIGHT = "Highlight"
|
||||
TI_DYNAMIC_UPDATES = "Dynamic Updates"
|
||||
TI_ANCHORS_TITLE = "anchor(s)"
|
||||
|
||||
-- [[ Profiler: window (Profiler/Window.lua) ]]
|
||||
PROFILER_TITLE = "Profiler"
|
||||
PROFILER_ANALYZER = "Analyzer"
|
||||
PROFILER_COPIED = "Copied %s bytes to the clipboard."
|
||||
PROFILER_FRAME_HIDDEN = "%s is hidden."
|
||||
|
||||
PROFILER_SEARCH_PLACEHOLDER = "Search name, owner or source"
|
||||
|
||||
PROFILER_COPY = "Copy"
|
||||
PROFILER_COPY_TIP = "Copy the shown rows to the clipboard as plain text."
|
||||
|
||||
PROFILER_RESET = "Reset"
|
||||
PROFILER_RESET_TIP = "Set every CPU time, call count, allocation and event count to zero."
|
||||
|
||||
PROFILER_ON = "ON"
|
||||
PROFILER_OFF = "OFF"
|
||||
|
||||
PROFILER_DEEP_TRACKING = "Deep Tracking: "
|
||||
PROFILER_DEEP_TRACKING_TIP = "Hooks the OnUpdate and OnEvent scripts of every frame to measure the Lua memory each frame allocates, and the CPU time and memory of each event. The hooks never replace a handler, but they add a little time to every script call. They stay until /reload."
|
||||
|
||||
PROFILER_CPU_PROFILING = "CPU Profiling: "
|
||||
PROFILER_CPU_PROFILING_TIP_ON = "Turn CPU profiling off"
|
||||
PROFILER_CPU_PROFILING_TIP_OFF = "Turn CPU profiling on"
|
||||
PROFILER_CPU_PROFILING_TIP_BODY = " and reload the UI.\n\nProfiling measures the CPU time of every addon, frame, function and event. It makes each Lua call slower, so turn it off when you are done."
|
||||
|
||||
-- [[ Profiler: slash commands (Profiler/Core.lua) ]]
|
||||
PROFILER_RESET_MSG = "CPU and allocation counters reset."
|
||||
PROFILER_SLASH_1 = "/profiler - toggle the analyzer"
|
||||
PROFILER_SLASH_2 = "/profiler widget - toggle the memory widget"
|
||||
PROFILER_SLASH_3 = "/profiler reset - reset CPU and allocation counters"
|
||||
PROFILER_SLASH_4 = "/profiler profile on|off - CPU profiling (reloads the UI)"
|
||||
|
||||
-- [[ Profiler: tab names (passed to ns.AddTab) ]]
|
||||
PROFILER_TAB_ADDONS = "Addons"
|
||||
PROFILER_TAB_FRAMES = "Frames"
|
||||
PROFILER_TAB_EVENTS = "Events"
|
||||
PROFILER_TAB_GLOBALS = "Globals"
|
||||
|
||||
-- [[ Profiler: "Owner" etc. labels shared by several tooltips ]]
|
||||
PROFILER_LABEL_OWNER = "Owner"
|
||||
PROFILER_LABEL_TYPE = "Type"
|
||||
PROFILER_LABEL_STATE = "State"
|
||||
PROFILER_LABEL_ALL_SCRIPTS = "All scripts"
|
||||
PROFILER_LABEL_ALLOCATED = "Allocated"
|
||||
PROFILER_LABEL_EVENTS = "Events"
|
||||
PROFILER_LABEL_LISTENERS = "Listeners"
|
||||
PROFILER_LABEL_FIRED = "Fired"
|
||||
PROFILER_LABEL_HANDLERS_RAN = "Handlers ran"
|
||||
PROFILER_LABEL_HANDLER_CPU = "Handler CPU"
|
||||
PROFILER_LABEL_CPU = "CPU"
|
||||
PROFILER_LABEL_CALLS = "Calls"
|
||||
PROFILER_LABEL_PER_CALL = "Per call"
|
||||
PROFILER_LABEL_ENTRIES = "Entries"
|
||||
PROFILER_LABEL_DEBUG_NAME = "Debug name"
|
||||
PROFILER_LABEL_VALUE = "Value"
|
||||
|
||||
PROFILER_STATE_VISIBLE = "visible"
|
||||
PROFILER_STATE_SHOWN_HIDDEN = "shown, parent hidden"
|
||||
PROFILER_STATE_HIDDEN = "hidden"
|
||||
|
||||
PROFILER_MORE_LISTENERS = "and %d more"
|
||||
PROFILER_CALLS_FORMAT = " in %s calls"
|
||||
|
||||
PROFILER_LABEL_CLICK_SHOW_FRAMES = "Click: show its frames. Right-click: more."
|
||||
PROFILER_LABEL_RIGHT_CLICK_HINT = "Right-click: highlight, inspect or copy."
|
||||
PROFILER_LABEL_TURN_ON_PROFILING = "Turn on CPU profiling to see CPU times."
|
||||
PROFILER_LABEL_NOT_CLASSICAPI = "Not ClassicAPI's function: something replaced or hooked it."
|
||||
PROFILER_LABEL_REPLACED = " (replaced)"
|
||||
|
||||
-- [[ Profiler: Addons tab (Profiler/AddonsTab.lua) ]]
|
||||
-- column titles
|
||||
PROFILER_ADDONS_COL_ADDON = "Addon"
|
||||
PROFILER_ADDONS_COL_MEMORY = "Memory"
|
||||
PROFILER_ADDONS_COL_ALLOC_S = "Alloc/s"
|
||||
PROFILER_ADDONS_COL_PEAK_S = "Peak/s"
|
||||
PROFILER_ADDONS_COL_CPU_S = "CPU/s"
|
||||
PROFILER_ADDONS_COL_CPU_PCT = "CPU %"
|
||||
PROFILER_ADDONS_COL_CPU_TOTAL = "CPU Total"
|
||||
|
||||
-- column tips
|
||||
PROFILER_ADDONS_TIP_MEMORY = "The Lua memory that the addon's objects use now."
|
||||
PROFILER_ADDONS_TIP_ALLOC_S = "The Lua memory the addon allocated in the last second. Allocations become garbage that the collector must free. A second with a garbage collection keeps the previous value."
|
||||
PROFILER_ADDONS_TIP_PEAK_S = "The highest Alloc/s since the last reset."
|
||||
PROFILER_ADDONS_TIP_CPU_S = "The CPU time of the addon's own functions in the last second. Needs CPU profiling."
|
||||
PROFILER_ADDONS_TIP_CPU_PCT = "The addon's share of the CPU time of all addons in the last second."
|
||||
PROFILER_ADDONS_TIP_CPU_TOTAL = "The CPU time of the addon's own functions since the last reset."
|
||||
|
||||
-- tooltip
|
||||
PROFILER_ADDONS_TT_MEMORY = "Memory"
|
||||
PROFILER_ADDONS_TT_ALLOCATED_S = "Allocated per second"
|
||||
PROFILER_ADDONS_TT_PEAK_S = "Peak per second"
|
||||
PROFILER_ADDONS_TT_CPU_S = "CPU per second"
|
||||
PROFILER_ADDONS_TT_CPU_RESET = "CPU since reset"
|
||||
|
||||
-- menu
|
||||
PROFILER_ADDONS_MENU_SHOW_FRAMES = "Show frames"
|
||||
PROFILER_ADDONS_MENU_SHOW_GLOBALS = "Show globals"
|
||||
PROFILER_ADDONS_MENU_COPY_NAME = "Copy name"
|
||||
|
||||
-- status line
|
||||
PROFILER_ADDONS_STATUS = "%d addons Lua %s / %s"
|
||||
PROFILER_ADDONS_STATUS_SCRIPTS = " scripts %s/s events %s/s (%.0f fired/s)"
|
||||
|
||||
-- [[ Profiler: Frames tab (Profiler/FramesTab.lua) ]]
|
||||
PROFILER_FRAMES_COL_FRAME = "Frame"
|
||||
PROFILER_FRAMES_COL_OWNER = "Owner"
|
||||
PROFILER_FRAMES_COL_CPU_S = "CPU/s"
|
||||
PROFILER_FRAMES_COL_CALLS_S = "Calls/s"
|
||||
PROFILER_FRAMES_COL_PER_CALL = "Per Call"
|
||||
PROFILER_FRAMES_COL_ALLOC_S = "Alloc/s"
|
||||
PROFILER_FRAMES_COL_CPU_TOTAL = "CPU Total"
|
||||
|
||||
PROFILER_FRAMES_TIP_OWNER = "The addon that made the frame's OnUpdate or OnEvent handler, or the frame itself."
|
||||
PROFILER_FRAMES_TIP_CPU_S = "The CPU time of all the frame's scripts in the last second. Needs CPU profiling."
|
||||
PROFILER_FRAMES_TIP_CALLS_S = "How often the frame's scripts ran in the last second. Needs CPU profiling."
|
||||
PROFILER_FRAMES_TIP_PER_CALL = "The average CPU time of one script call since the last reset."
|
||||
PROFILER_FRAMES_TIP_ALLOC_S = "The Lua memory the frame's OnUpdate and OnEvent scripts allocated in the last second. Needs deep tracking."
|
||||
PROFILER_FRAMES_TIP_CPU_TOTAL = "The CPU time of all the frame's scripts since the last reset."
|
||||
|
||||
PROFILER_FRAMES_MENU_HIGHLIGHT = "Highlight"
|
||||
PROFILER_FRAMES_MENU_INSPECT = "Inspect"
|
||||
PROFILER_FRAMES_MENU_COPY_NAME = "Copy name"
|
||||
PROFILER_FRAMES_MENU_COPY_SRC = "Copy source location"
|
||||
PROFILER_FRAMES_MENU_SHOW_OWNER = "Show %s frames"
|
||||
|
||||
PROFILER_FRAMES_STATUS = "%d frames %d listed"
|
||||
PROFILER_FRAMES_STATUS_PROMPT = "Turn on CPU profiling or deep tracking to measure frames."
|
||||
PROFILER_FRAMES_STATUS_DEEP = " deep tracking on"
|
||||
|
||||
-- [[ Profiler: Events tab (Profiler/EventsTab.lua) ]]
|
||||
PROFILER_EVENTS_COL_EVENT = "Event"
|
||||
PROFILER_EVENTS_COL_FIRES_S = "Fires/s"
|
||||
PROFILER_EVENTS_COL_LISTENERS = "Listeners"
|
||||
PROFILER_EVENTS_COL_CPU_S = "CPU/s"
|
||||
PROFILER_EVENTS_COL_ALLOC_S = "Alloc/s"
|
||||
PROFILER_EVENTS_COL_FIRED = "Fired"
|
||||
|
||||
PROFILER_EVENTS_TIP_FIRES_S = "How often the event fired in the last second."
|
||||
PROFILER_EVENTS_TIP_LISTENERS = "The frames registered for the event."
|
||||
PROFILER_EVENTS_TIP_CPU_S = "The CPU time of the event's OnEvent handlers in the last second. Needs deep tracking and CPU profiling."
|
||||
PROFILER_EVENTS_TIP_ALLOC_S = "The Lua memory the event's OnEvent handlers allocated in the last second. Needs deep tracking."
|
||||
PROFILER_EVENTS_TIP_FIRED = "How often the event fired since the analyzer opened or the last reset."
|
||||
|
||||
PROFILER_EVENTS_MENU_COPY_NAME = "Copy name"
|
||||
|
||||
PROFILER_EVENTS_STATUS = "%d events seen %.0f fired/s"
|
||||
PROFILER_EVENTS_STATUS_PROMPT = "Turn on deep tracking for the CPU time and memory of each event."
|
||||
|
||||
-- [[ Profiler: Globals tab (Profiler/GlobalsTab.lua) ]]
|
||||
PROFILER_GLOBALS_COL_NAME = "Name"
|
||||
PROFILER_GLOBALS_COL_TYPE = "Type"
|
||||
PROFILER_GLOBALS_COL_OWNER = "Owner"
|
||||
PROFILER_GLOBALS_COL_CPU = "CPU"
|
||||
PROFILER_GLOBALS_COL_CALLS = "Calls"
|
||||
|
||||
PROFILER_GLOBALS_TIP_OWNER = "The addon that made the value. Strings, numbers and booleans have no owner."
|
||||
PROFILER_GLOBALS_TIP_CPU = "The CPU time of the function since the last reset. Needs CPU profiling."
|
||||
PROFILER_GLOBALS_TIP_CALLS = "How often the function ran since the last reset. Needs CPU profiling."
|
||||
|
||||
PROFILER_GLOBALS_MENU_INSPECT = "Inspect"
|
||||
PROFILER_GLOBALS_MENU_HIGHLIGHT = "Highlight"
|
||||
PROFILER_GLOBALS_MENU_COPY_NAME = "Copy name"
|
||||
|
||||
PROFILER_GLOBALS_RESCAN = "Rescan"
|
||||
PROFILER_GLOBALS_RESCAN_TIP = "Read the global namespace again. Also updates the CPU times."
|
||||
PROFILER_GLOBALS_SHOW_FRAMEXML = "Show FrameXML"
|
||||
PROFILER_GLOBALS_SHOW_FRAMEXML_TIP = "Also list the values the game's own code made, and plain strings, numbers and booleans. With CPU profiling this shows the cost of every game API function."
|
||||
|
||||
PROFILER_GLOBALS_STATUS = "%d globals listed %d ClassicAPI functions replaced or hooked"
|
||||
|
||||
-- [[ Profiler: widget (Profiler/Widget.lua) ]]
|
||||
PROFILER_WIDGET_MEMORY = "Memory"
|
||||
PROFILER_WIDGET_RATE = "Rate"
|
||||
PROFILER_WIDGET_LAST_CLEANUP = "Last Cleanup"
|
||||
PROFILER_WIDGET_FRAMERATE = "Framerate"
|
||||
PROFILER_WIDGET_LUA_CPU = "Lua CPU"
|
||||
PROFILER_WIDGET_TOP_ALLOC = "Top Alloc"
|
||||
PROFILER_WIDGET_TOP_CPU = "Top CPU"
|
||||
PROFILER_WIDGET_LAST_PEAK = "Last Peak (100ms):|r "
|
||||
PROFILER_WIDGET_COLLECTED = "collected "
|
||||
PROFILER_WIDGET_NONE_YET = "none yet"
|
||||
PROFILER_WIDGET_PROFILING_OFF = "profiling off"
|
||||
PROFILER_WIDGET_TT_TITLE = "Profiler"
|
||||
PROFILER_WIDGET_ALLOC_PER_SEC = "Allocated per second"
|
||||
PROFILER_WIDGET_CPU_PER_SEC = "CPU per second"
|
||||
PROFILER_WIDGET_LEFT_CLICK = "Left-click: reset the peak"
|
||||
PROFILER_WIDGET_RIGHT_CLICK = "Right-click: open the analyzer"
|
||||
PROFILER_WIDGET_DRAG = "Drag: move"
|
||||
@@ -0,0 +1,4 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
<Script file="enUS.lua"/>
|
||||
<Script file="zhCN.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,203 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- ClassicAPI_DebugTools: 简体中文
|
||||
------------------------------------------------------------------------------
|
||||
if GetLocale() ~= "zhCN" then return end
|
||||
|
||||
-- [[ FrameStack / /fstack / texture info (DebugTools.lua) ]]
|
||||
TI_INVALID_COORDS = "无效坐标"
|
||||
TI_FILE_LABEL = "文件"
|
||||
FS_FSOBJ_LABEL = "fsobj = %s"
|
||||
|
||||
-- [[ Table Inspector main window (TableInspector.lua + .xml) ]]
|
||||
TI_NO_TABLE_SELECTED = "未选择表"
|
||||
TI_FRAME_ATTRIBUTES = "Frame 属性 - "
|
||||
TI_TABLE_ATTRIBUTES = "Table 属性"
|
||||
|
||||
TI_SHOW = "显示"
|
||||
TI_HIGHLIGHT = "高亮"
|
||||
TI_DYNAMIC_UPDATES = "动态更新"
|
||||
TI_ANCHORS_TITLE = "锚点"
|
||||
|
||||
-- [[ Profiler: window (Profiler/Window.lua) ]]
|
||||
PROFILER_TITLE = "性能分析器"
|
||||
PROFILER_ANALYZER = "分析器"
|
||||
PROFILER_COPIED = "已复制 %s 字节到剪贴板。"
|
||||
PROFILER_FRAME_HIDDEN = "%s 处于隐藏状态。"
|
||||
|
||||
PROFILER_SEARCH_PLACEHOLDER = "搜索名称、所有者或来源"
|
||||
|
||||
PROFILER_COPY = "复制"
|
||||
PROFILER_COPY_TIP = "将当前显示的行以纯文本复制到剪贴板。"
|
||||
|
||||
PROFILER_RESET = "重置"
|
||||
PROFILER_RESET_TIP = "将所有 CPU 时间、调用次数、内存分配和事件计数归零。"
|
||||
|
||||
PROFILER_ON = "开"
|
||||
PROFILER_OFF = "关"
|
||||
|
||||
PROFILER_DEEP_TRACKING = "深度追踪: "
|
||||
PROFILER_DEEP_TRACKING_TIP = "挂接每个 Frame 的 OnUpdate 和 OnEvent 脚本,测量该 Frame 分配的 Lua 内存,以及每个事件的 CPU 时间和内存占用。钩子不会替换原有处理函数,但每次脚本调用会增加少量开销,直到 /reload 才会移除。"
|
||||
|
||||
PROFILER_CPU_PROFILING = "CPU 分析: "
|
||||
PROFILER_CPU_PROFILING_TIP_ON = "关闭 CPU 分析"
|
||||
PROFILER_CPU_PROFILING_TIP_OFF = "开启 CPU 分析"
|
||||
PROFILER_CPU_PROFILING_TIP_BODY = " 并重载 UI。\n\n分析器会测量每个插件、Frame、函数和事件的 CPU 时间。这会让每次 Lua 调用变慢,完成后请及时关闭。"
|
||||
|
||||
-- [[ Profiler: slash commands (Profiler/Core.lua) ]]
|
||||
PROFILER_RESET_MSG = "CPU 与内存分配计数器已重置。"
|
||||
PROFILER_SLASH_1 = "/profiler - 打开或关闭分析器"
|
||||
PROFILER_SLASH_2 = "/profiler widget - 打开或关闭内存小部件"
|
||||
PROFILER_SLASH_3 = "/profiler reset - 重置 CPU 和内存分配计数器"
|
||||
PROFILER_SLASH_4 = "/profiler profile on|off - CPU 分析(会重载 UI)"
|
||||
|
||||
-- [[ Profiler: tab names (passed to ns.AddTab) ]]
|
||||
PROFILER_TAB_ADDONS = "插件"
|
||||
PROFILER_TAB_FRAMES = "Frames"
|
||||
PROFILER_TAB_EVENTS = "事件"
|
||||
PROFILER_TAB_GLOBALS = "全局变量"
|
||||
|
||||
-- [[ Profiler: "Owner" etc. labels shared by several tooltips ]]
|
||||
PROFILER_LABEL_OWNER = "所有者"
|
||||
PROFILER_LABEL_TYPE = "类型"
|
||||
PROFILER_LABEL_STATE = "状态"
|
||||
PROFILER_LABEL_ALL_SCRIPTS = "所有脚本"
|
||||
PROFILER_LABEL_ALLOCATED = "已分配"
|
||||
PROFILER_LABEL_EVENTS = "事件"
|
||||
PROFILER_LABEL_LISTENERS = "监听器"
|
||||
PROFILER_LABEL_FIRED = "触发"
|
||||
PROFILER_LABEL_HANDLERS_RAN = "处理函数执行次数"
|
||||
PROFILER_LABEL_HANDLER_CPU = "处理函数 CPU"
|
||||
PROFILER_LABEL_CPU = "CPU"
|
||||
PROFILER_LABEL_CALLS = "调用次数"
|
||||
PROFILER_LABEL_PER_CALL = "每次调用"
|
||||
PROFILER_LABEL_ENTRIES = "条目数"
|
||||
PROFILER_LABEL_DEBUG_NAME = "调试名"
|
||||
PROFILER_LABEL_VALUE = "值"
|
||||
|
||||
PROFILER_STATE_VISIBLE = "可见"
|
||||
PROFILER_STATE_SHOWN_HIDDEN = "已显示,父级隐藏"
|
||||
PROFILER_STATE_HIDDEN = "隐藏"
|
||||
|
||||
PROFILER_MORE_LISTENERS = "还有 %d 个"
|
||||
PROFILER_CALLS_FORMAT = " 共 %s 次调用"
|
||||
|
||||
PROFILER_LABEL_CLICK_SHOW_FRAMES = "左键:显示其 Frame。右键:更多操作。"
|
||||
PROFILER_LABEL_RIGHT_CLICK_HINT = "右键:高亮、查看或复制。"
|
||||
PROFILER_LABEL_TURN_ON_PROFILING = "开启 CPU 分析以查看 CPU 时间。"
|
||||
PROFILER_LABEL_NOT_CLASSICAPI = "不是 ClassicAPI 的函数:已被替换或挂接。"
|
||||
PROFILER_LABEL_REPLACED = "(已替换)"
|
||||
|
||||
-- [[ Profiler: Addons tab (Profiler/AddonsTab.lua) ]]
|
||||
PROFILER_ADDONS_COL_ADDON = "插件"
|
||||
PROFILER_ADDONS_COL_MEMORY = "内存"
|
||||
PROFILER_ADDONS_COL_ALLOC_S = "分配/s"
|
||||
PROFILER_ADDONS_COL_PEAK_S = "峰值/s"
|
||||
PROFILER_ADDONS_COL_CPU_S = "CPU/s"
|
||||
PROFILER_ADDONS_COL_CPU_PCT = "CPU 占比"
|
||||
PROFILER_ADDONS_COL_CPU_TOTAL = "CPU 总计"
|
||||
|
||||
PROFILER_ADDONS_TIP_MEMORY = "该插件当前对象占用的 Lua 内存。"
|
||||
PROFILER_ADDONS_TIP_ALLOC_S = "上一秒内该插件分配的 Lua 内存。内存分配最终会变成垃圾,由收集器回收。若上一秒发生了垃圾回收,则保持上次的值。"
|
||||
PROFILER_ADDONS_TIP_PEAK_S = "上次重置以来的最高分配/s。"
|
||||
PROFILER_ADDONS_TIP_CPU_S = "上一秒内该插件自身函数的 CPU 时间。需要开启 CPU 分析。"
|
||||
PROFILER_ADDONS_TIP_CPU_PCT = "上一秒内该插件在所有插件 CPU 时间中的占比。"
|
||||
PROFILER_ADDONS_TIP_CPU_TOTAL = "上次重置以来该插件自身函数的 CPU 时间。"
|
||||
|
||||
PROFILER_ADDONS_TT_MEMORY = "内存"
|
||||
PROFILER_ADDONS_TT_ALLOCATED_S = "每秒分配"
|
||||
PROFILER_ADDONS_TT_PEAK_S = "每秒峰值"
|
||||
PROFILER_ADDONS_TT_CPU_S = "每秒 CPU"
|
||||
PROFILER_ADDONS_TT_CPU_RESET = "重置后 CPU"
|
||||
|
||||
PROFILER_ADDONS_MENU_SHOW_FRAMES = "显示 Frame"
|
||||
PROFILER_ADDONS_MENU_SHOW_GLOBALS = "显示全局变量"
|
||||
PROFILER_ADDONS_MENU_COPY_NAME = "复制名称"
|
||||
|
||||
PROFILER_ADDONS_STATUS = "%d 个插件 Lua %s / %s"
|
||||
PROFILER_ADDONS_STATUS_SCRIPTS = " 脚本 %s/s 事件 %s/s (%.0f 次触发/s)"
|
||||
|
||||
-- [[ Profiler: Frames tab (Profiler/FramesTab.lua) ]]
|
||||
PROFILER_FRAMES_COL_FRAME = "Frame"
|
||||
PROFILER_FRAMES_COL_OWNER = "所有者"
|
||||
PROFILER_FRAMES_COL_CPU_S = "CPU/s"
|
||||
PROFILER_FRAMES_COL_CALLS_S = "调用/s"
|
||||
PROFILER_FRAMES_COL_PER_CALL = "每次调用"
|
||||
PROFILER_FRAMES_COL_ALLOC_S = "分配/s"
|
||||
PROFILER_FRAMES_COL_CPU_TOTAL = "CPU 总计"
|
||||
|
||||
PROFILER_FRAMES_TIP_OWNER = "为该 Frame 的 OnUpdate 或 OnEvent 提供处理函数的插件,或 Frame 自身。"
|
||||
PROFILER_FRAMES_TIP_CPU_S = "上一秒内该 Frame 所有脚本的 CPU 时间。需要开启 CPU 分析。"
|
||||
PROFILER_FRAMES_TIP_CALLS_S = "上一秒内该 Frame 脚本的运行次数。需要开启 CPU 分析。"
|
||||
PROFILER_FRAMES_TIP_PER_CALL = "上次重置以来单次脚本调用的平均 CPU 时间。"
|
||||
PROFILER_FRAMES_TIP_ALLOC_S = "上一秒内该 Frame OnUpdate 和 OnEvent 脚本分配的 Lua 内存。需要开启深度追踪。"
|
||||
PROFILER_FRAMES_TIP_CPU_TOTAL = "上次重置以来该 Frame 所有脚本的 CPU 时间。"
|
||||
|
||||
PROFILER_FRAMES_MENU_HIGHLIGHT = "高亮"
|
||||
PROFILER_FRAMES_MENU_INSPECT = "查看结构"
|
||||
PROFILER_FRAMES_MENU_COPY_NAME = "复制名称"
|
||||
PROFILER_FRAMES_MENU_COPY_SRC = "复制源码位置"
|
||||
PROFILER_FRAMES_MENU_SHOW_OWNER = "显示 %s 的 Frame"
|
||||
|
||||
PROFILER_FRAMES_STATUS = "%d 个 Frame 已列出 %d 个"
|
||||
PROFILER_FRAMES_STATUS_PROMPT = "开启 CPU 分析或深度追踪以测量 Frame 数据。"
|
||||
PROFILER_FRAMES_STATUS_DEEP = " 深度追踪已开启"
|
||||
|
||||
-- [[ Profiler: Events tab (Profiler/EventsTab.lua) ]]
|
||||
PROFILER_EVENTS_COL_EVENT = "事件"
|
||||
PROFILER_EVENTS_COL_FIRES_S = "触发/s"
|
||||
PROFILER_EVENTS_COL_LISTENERS = "监听器"
|
||||
PROFILER_EVENTS_COL_CPU_S = "CPU/s"
|
||||
PROFILER_EVENTS_COL_ALLOC_S = "分配/s"
|
||||
PROFILER_EVENTS_COL_FIRED = "触发次数"
|
||||
|
||||
PROFILER_EVENTS_TIP_FIRES_S = "上一秒内该事件的触发频率。"
|
||||
PROFILER_EVENTS_TIP_LISTENERS = "注册了该事件的 Frame 数量。"
|
||||
PROFILER_EVENTS_TIP_CPU_S = "上一秒内该事件 OnEvent 处理函数的 CPU 时间。需要深度追踪和 CPU 分析。"
|
||||
PROFILER_EVENTS_TIP_ALLOC_S = "上一秒内该事件 OnEvent 处理函数分配的 Lua 内存。需要深度追踪。"
|
||||
PROFILER_EVENTS_TIP_FIRED = "分析器打开或上次重置以来该事件的总触发次数。"
|
||||
|
||||
PROFILER_EVENTS_MENU_COPY_NAME = "复制名称"
|
||||
|
||||
PROFILER_EVENTS_STATUS = "已看到 %d 个事件 每秒触发 %.0f 次"
|
||||
PROFILER_EVENTS_STATUS_PROMPT = "开启深度追踪以查看每个事件的 CPU 时间和内存占用。"
|
||||
|
||||
-- [[ Profiler: Globals tab (Profiler/GlobalsTab.lua) ]]
|
||||
PROFILER_GLOBALS_COL_NAME = "名称"
|
||||
PROFILER_GLOBALS_COL_TYPE = "类型"
|
||||
PROFILER_GLOBALS_COL_OWNER = "所有者"
|
||||
PROFILER_GLOBALS_COL_CPU = "CPU"
|
||||
PROFILER_GLOBALS_COL_CALLS = "调用次数"
|
||||
|
||||
PROFILER_GLOBALS_TIP_OWNER = "创建该值的插件。字符串、数字和布尔值没有所有者。"
|
||||
PROFILER_GLOBALS_TIP_CPU = "上次重置以来该函数的 CPU 时间。需要开启 CPU 分析。"
|
||||
PROFILER_GLOBALS_TIP_CALLS = "上次重置以来该函数的运行次数。需要开启 CPU 分析。"
|
||||
|
||||
PROFILER_GLOBALS_MENU_INSPECT = "查看结构"
|
||||
PROFILER_GLOBALS_MENU_HIGHLIGHT = "高亮"
|
||||
PROFILER_GLOBALS_MENU_COPY_NAME = "复制名称"
|
||||
|
||||
PROFILER_GLOBALS_RESCAN = "重新扫描"
|
||||
PROFILER_GLOBALS_RESCAN_TIP = "重新读取全局命名空间,同时刷新 CPU 时间数据。"
|
||||
PROFILER_GLOBALS_SHOW_FRAMEXML = "显示 FrameXML"
|
||||
PROFILER_GLOBALS_SHOW_FRAMEXML_TIP = "同时列出游戏自身代码创建的值,以及普通字符串、数字和布尔值。开启 CPU 分析后可以看到每个游戏 API 函数的开销。"
|
||||
|
||||
PROFILER_GLOBALS_STATUS = "已列出 %d 个全局变量 %d 个 ClassicAPI 函数被替换或挂接"
|
||||
|
||||
-- [[ Profiler: widget (Profiler/Widget.lua) ]]
|
||||
PROFILER_WIDGET_MEMORY = "内存"
|
||||
PROFILER_WIDGET_RATE = "速率"
|
||||
PROFILER_WIDGET_LAST_CLEANUP = "上次清理"
|
||||
PROFILER_WIDGET_FRAMERATE = "帧率"
|
||||
PROFILER_WIDGET_LUA_CPU = "Lua CPU"
|
||||
PROFILER_WIDGET_TOP_ALLOC = "分配最多"
|
||||
PROFILER_WIDGET_TOP_CPU = "CPU 最多"
|
||||
PROFILER_WIDGET_LAST_PEAK = "上次峰值(100ms):|r "
|
||||
PROFILER_WIDGET_COLLECTED = "已回收 "
|
||||
PROFILER_WIDGET_NONE_YET = "尚无数据"
|
||||
PROFILER_WIDGET_PROFILING_OFF = "分析未开启"
|
||||
PROFILER_WIDGET_TT_TITLE = "性能分析器"
|
||||
PROFILER_WIDGET_ALLOC_PER_SEC = "每秒内存分配"
|
||||
PROFILER_WIDGET_CPU_PER_SEC = "每秒 CPU"
|
||||
PROFILER_WIDGET_LEFT_CLICK = "左键:重置峰值"
|
||||
PROFILER_WIDGET_RIGHT_CLICK = "右键:打开分析器"
|
||||
PROFILER_WIDGET_DRAG = "拖拽:移动"
|
||||
Reference in New Issue
Block a user