mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 20:24:16 +01:00
Merge pull request #1095 from BitsOfAByte/xlstats-totals
This commit is contained in:
commit
cde0667a40
1 changed files with 21 additions and 4 deletions
|
|
@ -6,6 +6,7 @@ using System.Reflection;
|
||||||
|
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Hooking.Internal;
|
using Dalamud.Hooking.Internal;
|
||||||
|
using Dalamud.Interface.Components;
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
|
|
@ -68,6 +69,16 @@ internal class PluginStatWindow : Window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var loadedPlugins = pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded);
|
||||||
|
var totalLast = loadedPlugins.Sum(plugin => plugin.DalamudInterface?.UiBuilder.LastDrawTime ?? 0);
|
||||||
|
var totalAverage = loadedPlugins.Sum(plugin => plugin.DalamudInterface?.UiBuilder.DrawTimeHistory.DefaultIfEmpty().Average() ?? 0);
|
||||||
|
|
||||||
|
ImGuiComponents.TextWithLabel("Total Last", $"{totalLast / 10000f:F4}ms", "All last draw times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Total Average", $"{totalAverage / 10000f:F4}ms", "All average draw times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Collective Average", $"{(loadedPlugins.Any() ? totalAverage / loadedPlugins.Count() / 10000f : 0):F4}ms", "Average of all average draw times");
|
||||||
|
|
||||||
if (ImGui.BeginTable(
|
if (ImGui.BeginTable(
|
||||||
"##PluginStatsDrawTimes",
|
"##PluginStatsDrawTimes",
|
||||||
4,
|
4,
|
||||||
|
|
@ -86,8 +97,6 @@ internal class PluginStatWindow : Window
|
||||||
ImGui.TableSetupColumn("Average");
|
ImGui.TableSetupColumn("Average");
|
||||||
ImGui.TableHeadersRow();
|
ImGui.TableHeadersRow();
|
||||||
|
|
||||||
var loadedPlugins = pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded);
|
|
||||||
|
|
||||||
var sortSpecs = ImGui.TableGetSortSpecs();
|
var sortSpecs = ImGui.TableGetSortSpecs();
|
||||||
loadedPlugins = sortSpecs.Specs.ColumnIndex switch
|
loadedPlugins = sortSpecs.Specs.ColumnIndex switch
|
||||||
{
|
{
|
||||||
|
|
@ -149,6 +158,16 @@ internal class PluginStatWindow : Window
|
||||||
Framework.StatsHistory.Clear();
|
Framework.StatsHistory.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var statsHistory = Framework.StatsHistory.ToArray();
|
||||||
|
var totalLast = statsHistory.Sum(stats => stats.Value.LastOrDefault());
|
||||||
|
var totalAverage = statsHistory.Sum(stats => stats.Value.Average());
|
||||||
|
|
||||||
|
ImGuiComponents.TextWithLabel("Total Last", $"{totalLast:F4}ms", "All last update times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Total Average", $"{totalAverage:F4}ms", "All average update times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Collective Average", $"{(statsHistory.Any() ? totalAverage / statsHistory.Length : 0):F4}ms", "Average of all average update times");
|
||||||
|
|
||||||
if (ImGui.BeginTable(
|
if (ImGui.BeginTable(
|
||||||
"##PluginStatsFrameworkTimes",
|
"##PluginStatsFrameworkTimes",
|
||||||
4,
|
4,
|
||||||
|
|
@ -167,8 +186,6 @@ internal class PluginStatWindow : Window
|
||||||
ImGui.TableSetupColumn("Average", ImGuiTableColumnFlags.None, 50);
|
ImGui.TableSetupColumn("Average", ImGuiTableColumnFlags.None, 50);
|
||||||
ImGui.TableHeadersRow();
|
ImGui.TableHeadersRow();
|
||||||
|
|
||||||
var statsHistory = Framework.StatsHistory.ToArray();
|
|
||||||
|
|
||||||
var sortSpecs = ImGui.TableGetSortSpecs();
|
var sortSpecs = ImGui.TableGetSortSpecs();
|
||||||
statsHistory = sortSpecs.Specs.ColumnIndex switch
|
statsHistory = sortSpecs.Specs.ColumnIndex switch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue