mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
Add totals to xlstats
This commit is contained in:
parent
9a32da7db8
commit
b460ffc16b
1 changed files with 35 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,24 @@ internal class PluginStatWindow : Window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var loadedPlugins = pluginManager.InstalledPlugins.Where(plugin => plugin.State == PluginState.Loaded);
|
||||||
|
|
||||||
|
var allLast = loadedPlugins
|
||||||
|
.DefaultIfEmpty()
|
||||||
|
.Where(plugin => plugin.DalamudInterface != null)
|
||||||
|
.Select(plugin => plugin.DalamudInterface.UiBuilder.LastDrawTime);
|
||||||
|
|
||||||
|
var allAverage = loadedPlugins
|
||||||
|
.DefaultIfEmpty()
|
||||||
|
.Where(plugin => plugin.DalamudInterface != null)
|
||||||
|
.Select(plugin => plugin.DalamudInterface.UiBuilder.DrawTimeHistory.DefaultIfEmpty().Average());
|
||||||
|
|
||||||
|
ImGuiComponents.TextWithLabel("Total Last", $"{allLast.Aggregate(0d, (a, b) => a + b) / 10000f:F4}ms", "All last draw times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Total Average", $"{allAverage.Aggregate(0d, (a, b) => a + b) / 10000f:F4}ms", "All average draw times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Collective Average", $"{allAverage.Average() / 10000f:F4}ms", "Average of all average draw times");
|
||||||
|
|
||||||
if (ImGui.BeginTable(
|
if (ImGui.BeginTable(
|
||||||
"##PluginStatsDrawTimes",
|
"##PluginStatsDrawTimes",
|
||||||
4,
|
4,
|
||||||
|
|
@ -86,8 +105,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 +166,22 @@ internal class PluginStatWindow : Window
|
||||||
Framework.StatsHistory.Clear();
|
Framework.StatsHistory.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var statsHistory = Framework.StatsHistory.ToArray();
|
||||||
|
|
||||||
|
var allLast = statsHistory
|
||||||
|
.DefaultIfEmpty()
|
||||||
|
.Select(x => x.Value.LastOrDefault());
|
||||||
|
|
||||||
|
var allAverage = statsHistory
|
||||||
|
.DefaultIfEmpty()
|
||||||
|
.Select(x => x.Value.DefaultIfEmpty().Average());
|
||||||
|
|
||||||
|
ImGuiComponents.TextWithLabel("Total Last", $"{allLast.Aggregate(0d, (a, b) => a + b):F4}ms", "All last update times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Total Average", $"{allAverage.Aggregate(0d, (a, b) => a + b):F4}ms", "All average update times added together");
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.TextWithLabel("Collective Average", $"{allAverage.Average():F4}ms", "Average of all average update times");
|
||||||
|
|
||||||
if (ImGui.BeginTable(
|
if (ImGui.BeginTable(
|
||||||
"##PluginStatsFrameworkTimes",
|
"##PluginStatsFrameworkTimes",
|
||||||
4,
|
4,
|
||||||
|
|
@ -167,8 +200,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