From 99ae67dad07b46107fff333f28a6299dc839594b Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Tue, 13 Dec 2022 17:57:34 +0000 Subject: [PATCH] Add additional logging statements during sorting Indicating the start of each stage of adding edges to the plugin graph. --- src/api/sorting/plugin_graph.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/api/sorting/plugin_graph.cpp b/src/api/sorting/plugin_graph.cpp index 72fe2c78..2b18694c 100644 --- a/src/api/sorting/plugin_graph.cpp +++ b/src/api/sorting/plugin_graph.cpp @@ -569,6 +569,12 @@ void PluginGraph::AddPluginVertices(const Game& game, } void PluginGraph::AddSpecificEdges() { + const auto logger = getLogger(); + if (logger) { + logger->trace( + "Adding edges based on plugin data and non-group metadata..."); + } + // Add edges for all relationships that aren't overlaps. for (auto [vit, vitend] = GetVertices(); vit != vitend; ++vit) { const auto& vertex = *vit; @@ -626,10 +632,16 @@ void PluginGraph::AddSpecificEdges() { void PluginGraph::AddHardcodedPluginEdges(const Game& game) { using std::filesystem::u8path; + const auto logger = getLogger(); + if (logger) { + logger->trace( + "Adding edges for implicitly active plugins and plugins with hardcoded " + "positions..."); + } + auto implicitlyActivePlugins = game.GetLoadOrderHandler().GetImplicitlyActivePlugins(); - auto logger = getLogger(); std::set processedPluginPaths; for (const auto& plugin : implicitlyActivePlugins) { processedPluginPaths.insert(NormalizeFilename(plugin)); @@ -672,10 +684,14 @@ void PluginGraph::AddHardcodedPluginEdges(const Game& game) { void PluginGraph::AddGroupEdges( const std::unordered_map& groups) { + const auto logger = getLogger(); + if (logger) { + logger->trace("Adding edges based on plugin group memberships..."); + } + std::vector> acyclicEdgePairs; std::map> groupPluginsToIgnore; - const auto logger = getLogger(); for (const vertex_t& vertex : boost::make_iterator_range(GetVertices())) { const auto& toPlugin = GetPlugin(vertex); @@ -757,6 +773,10 @@ void PluginGraph::AddGroupEdges( void PluginGraph::AddOverlapEdges() { const auto logger = getLogger(); + if (logger) { + logger->trace("Adding edges for overlapping plugins..."); + } + for (auto [vit, vitend] = GetVertices(); vit != vitend; ++vit) { const vertex_t vertex = *vit; const auto& plugin = GetPlugin(vertex); @@ -795,6 +815,11 @@ void PluginGraph::AddOverlapEdges() { } void PluginGraph::AddTieBreakEdges() { + const auto logger = getLogger(); + if (logger) { + logger->trace("Adding edges to break ties between plugins..."); + } + // In order for the sort to be performed stably, there must be only one // possible result. This can be enforced by adding edges between all vertices // that aren't already linked. Use existing load order to decide the direction