mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
pfDebug was a separate addon that profiled through ClassicAPI's own APIs: GetAddOnMemoryUsage and GetAddOnCPUUsage, GetFrameCPUUsage, GetFunctionCPUUsage, GetEventCPUUsage, and the intrinsic precall and postcall script hooks. Its code now lives in ClassicAPI_DebugTools under Profiler/, with its MIT notice (Copyright (c) 2018 Shagu). The analyzer tabs (Addons, Frames, Events, Globals) and the widget are pfDebug's, with the frame and template names renamed to ClassicAPIProfiler*. /profiler and /prof load DebugTools on demand through the same stub as /dump, then toggle the analyzer. The subcommands widget, reset and profile on|off are pfDebug's. What changed in the move: - The sampler starts only when the widget or the analyzer first opens, so a load for /dump costs nothing. It first takes every counter as it is, so the first CPU/s and KB/s cover one second, not the session. - Whether profiling runs is probed, not read from the cvar: a function is called once and GetFunctionCPUUsage must count that call. The scriptProfile cvar can already hold the next session's value. - A frame record starts at the frame's current CPU time and call count, and opening the analyzer takes every frame and event counter again, because the frame totals and the deep hooks keep counting while it is closed. pfDebug started records at 0, so the first scan and each reopen showed a frame's whole session as one second. - The /fstack lines (owner, OnUpdate and OnEvent owner and CPU, all scripts, deep allocations) are added at the end of FrameStackTooltip_OnTooltipSetFrameStack, not by hooking OnTooltipSetFrameStack. - No pfUI skin and no SavedVariables. The plain backdrop is pfDebug's own fallback. The widget no longer opens at login, because that would load DebugTools at login. README's Debug tools table gains /profiler and the new /fstack lines.