From 83a37518ceeda86287d63cb2c55a6431910a84f1 Mon Sep 17 00:00:00 2001 From: Continuity Date: Mon, 13 Jan 2025 21:57:08 +0100 Subject: [PATCH] - fixing an issue with profiling without stop --- Plater_ChangeLog.lua | 2 ++ Plater_Profiling.lua | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Plater_ChangeLog.lua b/Plater_ChangeLog.lua index a12b7d8a..2af80770 100644 --- a/Plater_ChangeLog.lua +++ b/Plater_ChangeLog.lua @@ -8,6 +8,8 @@ function Plater.GetChangelogTable() if (not Plater.ChangeLogTable) then Plater.ChangeLogTable = { + {1736801633, "Bug Fix", "Jan 13th, 2024", "Fixing an issue with profiling if stop was not used but results should be shown.", "cont1nuity"}, + {1736722279, "Bug Fix", "Jan 11th, 2024", "Fixing broken nameplate anchoring for WAs on forced blizzard nameplates (via LibGetFrame).", "cont1nuity"}, {1736722279, "Bug Fix", "Jan 10th, 2024", "Fixing range check for Dark Ranger hunters (via LibRangeCheck).", "cont1nuity"}, {1736722279, "Bug Fix", "Jan 10th, 2024", "Fixing range check for cases when no range can be selected.", "cont1nuity"}, diff --git a/Plater_Profiling.lua b/Plater_Profiling.lua index 63c022d8..dc7af324 100644 --- a/Plater_Profiling.lua +++ b/Plater_Profiling.lua @@ -241,6 +241,7 @@ function Plater.EnableProfiling(core) Plater.EndLogPerformanceCore = EndLogPerformance end + addonMetricsAtEnd = {} -- reset addonMetricsAtStart = {} addonMetricsAtStart.global = {} addonMetricsAtStart.Plater = {} @@ -646,9 +647,24 @@ local function getAdvancedPerfData() end end + local resetEndMetrics = false -- in case "stop" was not used, show current snapshot + if not addonMetricsAtEnd.global then + addonMetricsAtEnd = {} + addonMetricsAtEnd.global = {} + addonMetricsAtEnd.Plater = {} + for _, metric in pairs(addonMetricsNames) do + addonMetricsAtEnd.Plater[metric] = C_AddOnProfiler.GetAddOnMetric(addonId, Enum.AddOnProfilerMetric[metric]) + end + for _, metric in pairs(addonMetricsNames) do + addonMetricsAtEnd.global[metric] = C_AddOnProfiler.GetOverallMetric(Enum.AddOnProfilerMetric[metric]) + end + resetEndMetrics = true + end + local profilingMetrics = {} profilingMetrics.global = {} profilingMetrics.Plater = {} + printStrHeader = printStrHeader .. "\n\nAddon Metrics for profiling session:" printStrHeader = printStrHeader .. "\n\n" .. PRT_INDENT .. "Overall Addon Metrics:\n" for _, metric in pairs(addonMetricsNamesForSession) do @@ -666,6 +682,10 @@ local function getAdvancedPerfData() end end + if resetEndMetrics then + addonMetricsAtEnd = {} + end + end printStrHeader = printStrHeader .. "\n\n"