Skip to content

Commit

Permalink
ResetEngine replaced (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivaylo-matov authored Nov 6, 2024
1 parent bf84d45 commit 6836a09
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions TuneUp/TuneUpWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Dynamo.Graph.Annotations;
using Dynamo.Graph.Nodes;
using Dynamo.Graph.Workspaces;
using Dynamo.Models;
using Dynamo.ViewModels;
using Dynamo.Wpf.Extensions;
using Dynamo.Wpf.Utilities;
Expand Down Expand Up @@ -356,13 +357,22 @@ internal void ResetProfiling()
// Put the graph into manual mode as there is no guarantee that nodes will be marked
// dirty in topologically sorted order during a reset.
SwitchToManualMode();
// TODO: need a way to do this from an extension and not cause a run.
// DynamoModel interface or a more specific reset command.
(viewLoadedParams.DynamoWindow.DataContext as DynamoViewModel).Model.ResetEngine(true);

// Enable profiling on the new engine controller after the reset.
CurrentWorkspace.EngineController.EnableProfiling(true, currentWorkspace, currentWorkspace.Nodes);
// run the graph now that profiling is enabled.
CurrentWorkspace.Run();

// Ensure all nodes are marked as modified
foreach (var node in viewLoadedParams.CurrentWorkspaceModel.Nodes)
{
node.RegisterAllPorts();
node.MarkNodeAsModified(true);
}

// Execute the Run command
viewLoadedParams.CommandExecutive.ExecuteCommand(
new DynamoModel.RunCancelCommand(true, false),
Guid.NewGuid().ToString(),
"TuneUp Run All");

isProfilingEnabled = true;
executionTimeData = CurrentWorkspace.EngineController.ExecutionTimeData;
Expand Down

0 comments on commit 6836a09

Please sign in to comment.