From 0cac1b5ced8d3a58ed0688fae58ae6295361b7e0 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Thu, 11 Apr 2019 18:34:30 -0400 Subject: [PATCH 1/9] Initial Commit --- src/DynamoCore/DynamoCore.csproj | 1 + src/DynamoCore/Models/DynamoModelEvents.cs | 2 +- .../Visualization}/GeometryHolder.cs | 3 +- src/DynamoWPFCLI/DynamoWPFCLI.csproj | 1 - .../DynamoCoreWpfTests.csproj | 1 + test/DynamoCoreWpfTests/GraphViewTests.cs | 80 +++++++++++++++++++ .../DynamoViewPerformanceTestBase.cs | 55 ++++++++----- .../PerformanceTestConsoleApp.cs | 2 +- 8 files changed, 122 insertions(+), 23 deletions(-) rename src/{DynamoWPFCLI => DynamoCore/Visualization}/GeometryHolder.cs (98%) create mode 100644 test/DynamoCoreWpfTests/GraphViewTests.cs diff --git a/src/DynamoCore/DynamoCore.csproj b/src/DynamoCore/DynamoCore.csproj index 7e2939422f0..c9a4273b145 100644 --- a/src/DynamoCore/DynamoCore.csproj +++ b/src/DynamoCore/DynamoCore.csproj @@ -142,6 +142,7 @@ limitations under the License. + diff --git a/src/DynamoCore/Models/DynamoModelEvents.cs b/src/DynamoCore/Models/DynamoModelEvents.cs index 3387c4cc170..2a381d3cbe9 100644 --- a/src/DynamoCore/Models/DynamoModelEvents.cs +++ b/src/DynamoCore/Models/DynamoModelEvents.cs @@ -320,7 +320,7 @@ public virtual void OnEvaluationCompleted(object sender, EvaluationCompletedEven { Action showFailureMessage = () => DisplayEngineFailureMessage(e.Error); OnRequestDispatcherBeginInvoke(showFailureMessage); - } + } if (EvaluationCompleted != null) EvaluationCompleted(sender, e); diff --git a/src/DynamoWPFCLI/GeometryHolder.cs b/src/DynamoCore/Visualization/GeometryHolder.cs similarity index 98% rename from src/DynamoWPFCLI/GeometryHolder.cs rename to src/DynamoCore/Visualization/GeometryHolder.cs index 43e5e5a69be..35dcddea9c9 100644 --- a/src/DynamoWPFCLI/GeometryHolder.cs +++ b/src/DynamoCore/Visualization/GeometryHolder.cs @@ -5,9 +5,8 @@ using Autodesk.DesignScript.Interfaces; using Dynamo.Graph.Nodes; using Dynamo.Models; -using Dynamo.Visualization; -namespace DynamoWPFCLI +namespace Dynamo.Visualization { internal class GeometryData { diff --git a/src/DynamoWPFCLI/DynamoWPFCLI.csproj b/src/DynamoWPFCLI/DynamoWPFCLI.csproj index c237bffe4df..6601411c21f 100644 --- a/src/DynamoWPFCLI/DynamoWPFCLI.csproj +++ b/src/DynamoWPFCLI/DynamoWPFCLI.csproj @@ -56,7 +56,6 @@ AssemblySharedInfo.cs - diff --git a/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj b/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj index dbf00e18695..b9a228dd85a 100644 --- a/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj +++ b/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj @@ -132,6 +132,7 @@ Properties\AssemblySharedInfo.cs + diff --git a/test/DynamoCoreWpfTests/GraphViewTests.cs b/test/DynamoCoreWpfTests/GraphViewTests.cs new file mode 100644 index 00000000000..42ca1bbb6ad --- /dev/null +++ b/test/DynamoCoreWpfTests/GraphViewTests.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using System.Threading; +using Dynamo.Graph.Workspaces; +using Dynamo.Models; +using Dynamo.Visualization; +using DynamoCoreWpfTests.Utility; + +namespace DynamoCoreWpfTests +{ + public class GrapViewTests : DynamoTestUIBase + { + /// + /// Signal used for performance time measurement + /// + private static ManualResetEvent signalEvent = new ManualResetEvent(false); + + /// + /// Function used to measure file open which saved in manual mode + /// + /// + public override void Open(string path) + { + base.Open(path); + + DispatcherUtil.DoEvents(); + } + + /// + /// Event handler for EvaluationCompleted event + /// + /// sender + /// EvaluationCompletedEventArgs + void OnGraphEvaluationCompleted(object sender, EvaluationCompletedEventArgs e) + { + if (e.EvaluationSucceeded) + { + // Signal the signalEvent ready + signalEvent.Set(); + } + } + + /// + /// Function used to measure graph run with view + /// + public override void Run() + { + // A more precise way to measure the time spent is from when + // run() called to when even EvaluationCompleted is trigger on workspace + (Model.CurrentWorkspace as HomeWorkspaceModel).EvaluationCompleted += OnGraphEvaluationCompleted; + base.Run(); + signalEvent.WaitOne(); + signalEvent.Reset(); + // Unsubscribe + (Model.CurrentWorkspace as HomeWorkspaceModel).EvaluationCompleted -= OnGraphEvaluationCompleted; + } + + /// + /// Function used to measure graph geometry tessellation + /// + public void Tessellation() + { + var renderPackageFactory = new DefaultRenderPackageFactory(); + var nodeGeometries = new List(); + + foreach (var node in Model.CurrentWorkspace.Nodes) + { + nodeGeometries.Add(new GeometryHolder(Model, renderPackageFactory, node)); + } + + var geometry = new List(); + foreach (var holder in nodeGeometries) + { + if (holder.HasGeometry) + { + geometry.Add(holder.Geometry); + } + } + } + } +} \ No newline at end of file diff --git a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs index 58c92f9e6d0..514ce93f65e 100644 --- a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs +++ b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs @@ -8,7 +8,7 @@ namespace DynamoPerformanceTests { - public class DynamoViewPerformanceTestBase : NodeViewTests + public class DynamoViewPerformanceTestBase : GrapViewTests { /// /// Override this function to preload dlls into Dynamo library @@ -60,24 +60,37 @@ public static IEnumerable PerformanceTestSource() #region Iteration setup and cleanup methods for Benchmarks /// - /// Setup method to be called before each OpenModel benchmark. + /// Setup method to be called before each OpenGraph benchmark. /// - [IterationSetup(Target = nameof(OpenGraph))] - public void IterationSetupOpenModelWithUI() - { - Start(); - } + //[IterationSetup(Target = nameof(OpenGraph))] + //public void IterationSetupOpenModelWithUI() + //{ + // Start(); + //} + + /// + /// Setup method to be called before each RunGraph benchmark. + /// + //[IterationSetup(Target = nameof(RunGraph))] + //public void IterationSetupRunModelWithUI() + //{ + // Start(); + + // //open the dyn file + // Open(DynamoFilePath); + //} /// - /// Setup method to be called before each RunModel benchmark. + /// Setup method to be called before each RenderGraph benchmark. /// - [IterationSetup(Target = nameof(RunGraph))] - public void IterationSetupRunModelWithUI() + [IterationSetup(Target = nameof(GraphTessellation))] + public void IterationSetupRenderGraph() { Start(); //open the dyn file Open(DynamoFilePath); + Run(); } /// @@ -95,17 +108,23 @@ public void IterationCleanup() // The calling thread must be STA as a requirement // Otherwise, System.InvalidOperationException will be thrown during RunIteration - [Benchmark, System.STAThread] - public void OpenGraph() - { - //open the dyn file - Open(DynamoFilePath); - } + //[Benchmark, System.STAThread] + //public void OpenGraph() + //{ + // //open the dyn file + // Open(DynamoFilePath); + //} + + //[Benchmark, System.STAThread] + //public void RunGraph() + //{ + // Run(); + //} [Benchmark, System.STAThread] - public void RunGraph() + public void GraphTessellation() { - Run(); + Tessellation(); } #endregion diff --git a/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs b/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs index 444514c5667..651b317276e 100644 --- a/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs +++ b/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs @@ -33,7 +33,7 @@ public static void Main(string[] args) // PerformanceTestHelper.getDebugInProcessConfig(); DynamoViewPerformanceTestBase.testDirectory = dir.FullName; - var runSummaryWithUI = BenchmarkRunner.Run(PerformanceTestHelper.getFastReleaseConfig()); + var runSummaryWithUI = BenchmarkRunner.Run(PerformanceTestHelper.getDebugInProcessConfig()); DynamoModelPerformanceTestBase.testDirectory = dir.FullName; var runSummaryWithoutUI = BenchmarkRunner.Run(PerformanceTestHelper.getFastReleaseConfig()); From 14dc6425010c5392976eaef4eb1da94196a5d62e Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Fri, 12 Apr 2019 16:12:15 -0400 Subject: [PATCH 2/9] Updates to use HelixRenderPackageFactory --- .../Visualization/DefaultRenderPackageFactory.cs | 1 - src/DynamoCore/Visualization/GeometryHolder.cs | 2 +- test/DynamoCoreWpfTests/GraphViewTests.cs | 15 ++++++--------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/DynamoCore/Visualization/DefaultRenderPackageFactory.cs b/src/DynamoCore/Visualization/DefaultRenderPackageFactory.cs index e11e4997b60..736d1fb450d 100644 --- a/src/DynamoCore/Visualization/DefaultRenderPackageFactory.cs +++ b/src/DynamoCore/Visualization/DefaultRenderPackageFactory.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using Autodesk.DesignScript.Interfaces; -using Dynamo.Interfaces; namespace Dynamo.Visualization { diff --git a/src/DynamoCore/Visualization/GeometryHolder.cs b/src/DynamoCore/Visualization/GeometryHolder.cs index 35dcddea9c9..df92a59af04 100644 --- a/src/DynamoCore/Visualization/GeometryHolder.cs +++ b/src/DynamoCore/Visualization/GeometryHolder.cs @@ -99,7 +99,7 @@ public GeometryHolder(DynamoModel model, IRenderPackageFactory factory, NodeMode // Schedule the generation of render packages for this node. NodeRenderPackagesUpdated will be // called with the render packages when they are ready. The node will be set do 'Done' if the - // sheduling for some reason is not successful (usually becuase the node have no geometry or is inivisible) + // scheduling for some reason is not successful (usually because the node have no geometry or is invisible) nodeModel.RenderPackagesUpdated += NodeRenderPackagesUpdated; if (!nodeModel.RequestVisualUpdateAsync(model.Scheduler, model.EngineController, factory, true)) { diff --git a/test/DynamoCoreWpfTests/GraphViewTests.cs b/test/DynamoCoreWpfTests/GraphViewTests.cs index 42ca1bbb6ad..a7326e5cc8d 100644 --- a/test/DynamoCoreWpfTests/GraphViewTests.cs +++ b/test/DynamoCoreWpfTests/GraphViewTests.cs @@ -1,8 +1,7 @@ -using System.Collections.Generic; -using System.Threading; +using System.Threading; using Dynamo.Graph.Workspaces; using Dynamo.Models; -using Dynamo.Visualization; +using Dynamo.Wpf.Rendering; using DynamoCoreWpfTests.Utility; namespace DynamoCoreWpfTests @@ -59,7 +58,9 @@ public override void Run() /// public void Tessellation() { - var renderPackageFactory = new DefaultRenderPackageFactory(); + var renderPackageFactory = new HelixRenderPackageFactory(); + + // A list of GeometryHolder for all the nodes belong to the graph var nodeGeometries = new List(); foreach (var node in Model.CurrentWorkspace.Nodes) @@ -67,13 +68,9 @@ public void Tessellation() nodeGeometries.Add(new GeometryHolder(Model, renderPackageFactory, node)); } - var geometry = new List(); foreach (var holder in nodeGeometries) { - if (holder.HasGeometry) - { - geometry.Add(holder.Geometry); - } + holder.HasGeometry; } } } From 4238fa9168ab45a64a85a32830d440ce585a24f1 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Fri, 12 Apr 2019 18:12:58 -0400 Subject: [PATCH 3/9] Disable tessellation or rendering during graph run --- test/DynamoCoreWpfTests/GraphViewTests.cs | 24 +++++++++++++++-- .../DynamoViewPerformanceTestBase.cs | 27 ++++++++++--------- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/test/DynamoCoreWpfTests/GraphViewTests.cs b/test/DynamoCoreWpfTests/GraphViewTests.cs index a7326e5cc8d..9489d786e5f 100644 --- a/test/DynamoCoreWpfTests/GraphViewTests.cs +++ b/test/DynamoCoreWpfTests/GraphViewTests.cs @@ -1,11 +1,17 @@ -using System.Threading; +using System.Collections.Generic; +using System.Threading; using Dynamo.Graph.Workspaces; using Dynamo.Models; +using Dynamo.Visualization; using Dynamo.Wpf.Rendering; using DynamoCoreWpfTests.Utility; namespace DynamoCoreWpfTests { + + /// + /// This class should not be used for DynamoView unit tests + /// public class GrapViewTests : DynamoTestUIBase { /// @@ -24,6 +30,18 @@ public override void Open(string path) DispatcherUtil.DoEvents(); } + /// + /// Call this to disable the event handler to get render package + /// + public void DisableRendering() + { + // Dispose the background watch 3D ViewModel so no tessellation or rendering happen + foreach (var node in Model.CurrentWorkspace.Nodes) + { + ViewModel.BackgroundPreviewViewModel.UnregisterNodeEventHandlers(node); + } + } + /// /// Event handler for EvaluationCompleted event /// @@ -46,6 +64,7 @@ public override void Run() // A more precise way to measure the time spent is from when // run() called to when even EvaluationCompleted is trigger on workspace (Model.CurrentWorkspace as HomeWorkspaceModel).EvaluationCompleted += OnGraphEvaluationCompleted; + base.Run(); signalEvent.WaitOne(); signalEvent.Reset(); @@ -70,7 +89,8 @@ public void Tessellation() foreach (var holder in nodeGeometries) { - holder.HasGeometry; + if (holder.HasGeometry) + continue; } } } diff --git a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs index 514ce93f65e..8af5319d3f7 100644 --- a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs +++ b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs @@ -71,14 +71,17 @@ public static IEnumerable PerformanceTestSource() /// /// Setup method to be called before each RunGraph benchmark. /// - //[IterationSetup(Target = nameof(RunGraph))] - //public void IterationSetupRunModelWithUI() - //{ - // Start(); + [IterationSetup(Target = nameof(RunGraph))] + public void IterationSetupRunModelWithUI() + { + Start(); - // //open the dyn file - // Open(DynamoFilePath); - //} + // open the dyn file + Open(DynamoFilePath); + + // Disable tessellation or rendering + DisableRendering(); + } /// /// Setup method to be called before each RenderGraph benchmark. @@ -115,11 +118,11 @@ public void IterationCleanup() // Open(DynamoFilePath); //} - //[Benchmark, System.STAThread] - //public void RunGraph() - //{ - // Run(); - //} + [Benchmark, System.STAThread] + public void RunGraph() + { + Run(); + } [Benchmark, System.STAThread] public void GraphTessellation() From 2edffc3622c6a9814f0c74d3c74672cbe5a24f02 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Fri, 12 Apr 2019 18:21:06 -0400 Subject: [PATCH 4/9] clean up --- .../DynamoViewPerformanceTestBase.cs | 25 +++++++++++-------- .../PerformanceTestConsoleApp.cs | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs index 8af5319d3f7..ae0f2c63521 100644 --- a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs +++ b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs @@ -62,11 +62,11 @@ public static IEnumerable PerformanceTestSource() /// /// Setup method to be called before each OpenGraph benchmark. /// - //[IterationSetup(Target = nameof(OpenGraph))] - //public void IterationSetupOpenModelWithUI() - //{ - // Start(); - //} + [IterationSetup(Target = nameof(OpenGraph))] + public void IterationSetupOpenModelWithUI() + { + Start(); + } /// /// Setup method to be called before each RunGraph benchmark. @@ -93,6 +93,9 @@ public void IterationSetupRenderGraph() //open the dyn file Open(DynamoFilePath); + // Disable tessellation or rendering + DisableRendering(); + Run(); } @@ -111,12 +114,12 @@ public void IterationCleanup() // The calling thread must be STA as a requirement // Otherwise, System.InvalidOperationException will be thrown during RunIteration - //[Benchmark, System.STAThread] - //public void OpenGraph() - //{ - // //open the dyn file - // Open(DynamoFilePath); - //} + [Benchmark, System.STAThread] + public void OpenGraph() + { + //open the dyn file + Open(DynamoFilePath); + } [Benchmark, System.STAThread] public void RunGraph() diff --git a/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs b/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs index 651b317276e..444514c5667 100644 --- a/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs +++ b/tools/Performance/DynamoPerformanceTests/PerformanceTestConsoleApp.cs @@ -33,7 +33,7 @@ public static void Main(string[] args) // PerformanceTestHelper.getDebugInProcessConfig(); DynamoViewPerformanceTestBase.testDirectory = dir.FullName; - var runSummaryWithUI = BenchmarkRunner.Run(PerformanceTestHelper.getDebugInProcessConfig()); + var runSummaryWithUI = BenchmarkRunner.Run(PerformanceTestHelper.getFastReleaseConfig()); DynamoModelPerformanceTestBase.testDirectory = dir.FullName; var runSummaryWithoutUI = BenchmarkRunner.Run(PerformanceTestHelper.getFastReleaseConfig()); From d1c553cb8533845c1ac9433f0d5b2c4e8ab8b8e3 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Sun, 14 Apr 2019 20:34:53 -0400 Subject: [PATCH 5/9] Clean Up --- src/DynamoCoreWpf/Properties/AssemblyInfo.cs | 1 + .../ViewModels/Watch3D/DefaultWatch3DViewModel.cs | 2 +- .../Watch3DNodeModelsWpf/HelixWatch3DNodeViewModel.cs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/DynamoCoreWpf/Properties/AssemblyInfo.cs b/src/DynamoCoreWpf/Properties/AssemblyInfo.cs index 788c68df6d1..1e50d5822cb 100644 --- a/src/DynamoCoreWpf/Properties/AssemblyInfo.cs +++ b/src/DynamoCoreWpf/Properties/AssemblyInfo.cs @@ -35,3 +35,4 @@ [assembly: InternalsVisibleTo("ViewExtensionLibraryTests")] [assembly: InternalsVisibleTo("DynamoWPFCLI")] [assembly: InternalsVisibleTo("CommandLineTests")] +[assembly: InternalsVisibleTo("Watch3DNodeModelsWpf")] diff --git a/src/DynamoCoreWpf/ViewModels/Watch3D/DefaultWatch3DViewModel.cs b/src/DynamoCoreWpf/ViewModels/Watch3D/DefaultWatch3DViewModel.cs index 8eaef740f8b..d8b75643bc8 100644 --- a/src/DynamoCoreWpf/ViewModels/Watch3D/DefaultWatch3DViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Watch3D/DefaultWatch3DViewModel.cs @@ -557,7 +557,7 @@ private void RegisterNodeEventHandlers(NodeModel node) RegisterPortEventHandlers(node); } - protected void UnregisterNodeEventHandlers(NodeModel node) + internal void UnregisterNodeEventHandlers(NodeModel node) { node.PropertyChanged -= OnNodePropertyChanged; node.RenderPackagesUpdated -= OnRenderPackagesUpdated; diff --git a/src/Libraries/Watch3DNodeModelsWpf/HelixWatch3DNodeViewModel.cs b/src/Libraries/Watch3DNodeModelsWpf/HelixWatch3DNodeViewModel.cs index 3535f55f2b6..164233abb79 100644 --- a/src/Libraries/Watch3DNodeModelsWpf/HelixWatch3DNodeViewModel.cs +++ b/src/Libraries/Watch3DNodeModelsWpf/HelixWatch3DNodeViewModel.cs @@ -32,7 +32,7 @@ public HelixWatch3DNodeViewModel(Watch3D node, Watch3DViewModelStartupParams par Name = string.Format("{0} Preview", node.GUID); } - protected override void OnWatchExecution() + protected internal override void OnWatchExecution() { var watch3D = watchModel as Watch3D; if (watch3D != null) @@ -53,7 +53,7 @@ protected override void PortConnectedHandler(PortModel arg1, ConnectorModel arg2 UpdateUpstream(); } - protected override void UpdateUpstream() + protected internal override void UpdateUpstream() { OnClear(); From 9869c1df90adbc727f4044e87504fa290939e3c4 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Sun, 14 Apr 2019 21:48:22 -0400 Subject: [PATCH 6/9] More Comments --- test/DynamoCoreWpfTests/GraphViewTests.cs | 5 ++++- .../DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/DynamoCoreWpfTests/GraphViewTests.cs b/test/DynamoCoreWpfTests/GraphViewTests.cs index 9489d786e5f..d69d2280cb3 100644 --- a/test/DynamoCoreWpfTests/GraphViewTests.cs +++ b/test/DynamoCoreWpfTests/GraphViewTests.cs @@ -31,7 +31,9 @@ public override void Open(string path) } /// - /// Call this to disable the event handler to get render package + /// Call this to disable the event handler to get render package (Tessellation) + /// Rendering in helix view will also be disabled as a result of this + /// Currently only used in performance benchmarking /// public void DisableRendering() { @@ -84,6 +86,7 @@ public void Tessellation() foreach (var node in Model.CurrentWorkspace.Nodes) { + // Each Geometry Holder will request render packages and trigger Tessellation and Rendering nodeGeometries.Add(new GeometryHolder(Model, renderPackageFactory, node)); } diff --git a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs index ae0f2c63521..e6a11368aee 100644 --- a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs +++ b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs @@ -86,7 +86,7 @@ public void IterationSetupRunModelWithUI() /// /// Setup method to be called before each RenderGraph benchmark. /// - [IterationSetup(Target = nameof(GraphTessellation))] + [IterationSetup(Target = nameof(GraphTessellationAndRendering))] public void IterationSetupRenderGraph() { Start(); @@ -128,7 +128,7 @@ public void RunGraph() } [Benchmark, System.STAThread] - public void GraphTessellation() + public void GraphTessellationAndRendering() { Tessellation(); } From d46ce6e6850637a0a910220afda0a8d36c446970 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Mon, 15 Apr 2019 01:01:17 -0400 Subject: [PATCH 7/9] more comments --- test/DynamoCoreWpfTests/GraphViewTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/DynamoCoreWpfTests/GraphViewTests.cs b/test/DynamoCoreWpfTests/GraphViewTests.cs index d69d2280cb3..8bc61284899 100644 --- a/test/DynamoCoreWpfTests/GraphViewTests.cs +++ b/test/DynamoCoreWpfTests/GraphViewTests.cs @@ -10,7 +10,10 @@ namespace DynamoCoreWpfTests { /// - /// This class should not be used for DynamoView unit tests + /// This class should not be used for Dynamo View unit tests + /// because other than evaluation correctness, this test class focuses + /// more on the way to get time consumption of graph evaluation, + /// tessellation and rendering /// public class GrapViewTests : DynamoTestUIBase { From 0f1d553d9980167d76c66ada1b0b98f7ac773344 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Mon, 15 Apr 2019 13:53:38 -0400 Subject: [PATCH 8/9] Address Comments --- test/DynamoCoreWpfTests/GraphViewTests.cs | 8 ++++---- .../DynamoViewPerformanceTestBase.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/DynamoCoreWpfTests/GraphViewTests.cs b/test/DynamoCoreWpfTests/GraphViewTests.cs index 8bc61284899..2fd990a5fa1 100644 --- a/test/DynamoCoreWpfTests/GraphViewTests.cs +++ b/test/DynamoCoreWpfTests/GraphViewTests.cs @@ -10,9 +10,9 @@ namespace DynamoCoreWpfTests { /// - /// This class should not be used for Dynamo View unit tests - /// because other than evaluation correctness, this test class focuses - /// more on the way to get time consumption of graph evaluation, + /// This class should not be used for Dynamo View unit tests but performance + /// benchmarks because other than evaluation correctness, this test class + /// focuses more on the way to get time consumption of graph evaluation, /// tessellation and rendering /// public class GrapViewTests : DynamoTestUIBase @@ -80,7 +80,7 @@ public override void Run() /// /// Function used to measure graph geometry tessellation /// - public void Tessellation() + public void Tessellate() { var renderPackageFactory = new HelixRenderPackageFactory(); diff --git a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs index e6a11368aee..fe8ad05ca93 100644 --- a/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs +++ b/tools/Performance/DynamoPerformanceTests/DynamoViewPerformanceTestBase.cs @@ -84,7 +84,7 @@ public void IterationSetupRunModelWithUI() } /// - /// Setup method to be called before each RenderGraph benchmark. + /// Setup method to be called before each GraphTessellationAndRendering benchmark. /// [IterationSetup(Target = nameof(GraphTessellationAndRendering))] public void IterationSetupRenderGraph() @@ -130,7 +130,7 @@ public void RunGraph() [Benchmark, System.STAThread] public void GraphTessellationAndRendering() { - Tessellation(); + Tessellate(); } #endregion From c1d98eb5668bd0d6607696f58c562fd4ee37073e Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Mon, 15 Apr 2019 15:15:17 -0400 Subject: [PATCH 9/9] Move test file into performance test project --- src/DynamoCore/Properties/AssemblyInfo.cs | 1 + src/DynamoCoreWpf/Properties/AssemblyInfo.cs | 1 + test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj | 1 - .../DynamoPerformanceTests/DynamoPerformanceTests.csproj | 7 +++++++ .../Performance/DynamoPerformanceTests}/GraphViewTests.cs | 3 ++- 5 files changed, 11 insertions(+), 2 deletions(-) rename {test/DynamoCoreWpfTests => tools/Performance/DynamoPerformanceTests}/GraphViewTests.cs (98%) diff --git a/src/DynamoCore/Properties/AssemblyInfo.cs b/src/DynamoCore/Properties/AssemblyInfo.cs index fc024b12847..b236dab44c2 100644 --- a/src/DynamoCore/Properties/AssemblyInfo.cs +++ b/src/DynamoCore/Properties/AssemblyInfo.cs @@ -28,3 +28,4 @@ [assembly: InternalsVisibleTo("Dynamo.Storage")] [assembly: InternalsVisibleTo("LibraryViewExtension")] [assembly: InternalsVisibleTo("ViewExtensionLibraryTests")] +[assembly: InternalsVisibleTo("DynamoPerformanceTests")] diff --git a/src/DynamoCoreWpf/Properties/AssemblyInfo.cs b/src/DynamoCoreWpf/Properties/AssemblyInfo.cs index 1e50d5822cb..411017e14ef 100644 --- a/src/DynamoCoreWpf/Properties/AssemblyInfo.cs +++ b/src/DynamoCoreWpf/Properties/AssemblyInfo.cs @@ -36,3 +36,4 @@ [assembly: InternalsVisibleTo("DynamoWPFCLI")] [assembly: InternalsVisibleTo("CommandLineTests")] [assembly: InternalsVisibleTo("Watch3DNodeModelsWpf")] +[assembly: InternalsVisibleTo("DynamoPerformanceTests")] diff --git a/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj b/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj index b1b7e925596..389ba2475cb 100644 --- a/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj +++ b/test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj @@ -132,7 +132,6 @@ Properties\AssemblySharedInfo.cs - diff --git a/tools/Performance/DynamoPerformanceTests/DynamoPerformanceTests.csproj b/tools/Performance/DynamoPerformanceTests/DynamoPerformanceTests.csproj index 14ef17b4332..5ecdb953419 100644 --- a/tools/Performance/DynamoPerformanceTests/DynamoPerformanceTests.csproj +++ b/tools/Performance/DynamoPerformanceTests/DynamoPerformanceTests.csproj @@ -42,6 +42,12 @@ packages\CommandLineParser.2.4.3\lib\netstandard2.0\CommandLine.dll + + ..\..\..\bin\AnyCPU\$(Configuration)\DynamoCore.dll + + + ..\..\..\bin\AnyCPU\$(Configuration)\DynamoCoreWpf.dll + ..\..\..\bin\AnyCPU\$(Configuration)\DynamoCoreTests.dll @@ -223,6 +229,7 @@ + diff --git a/test/DynamoCoreWpfTests/GraphViewTests.cs b/tools/Performance/DynamoPerformanceTests/GraphViewTests.cs similarity index 98% rename from test/DynamoCoreWpfTests/GraphViewTests.cs rename to tools/Performance/DynamoPerformanceTests/GraphViewTests.cs index 2fd990a5fa1..56948ae23d9 100644 --- a/test/DynamoCoreWpfTests/GraphViewTests.cs +++ b/tools/Performance/DynamoPerformanceTests/GraphViewTests.cs @@ -4,9 +4,10 @@ using Dynamo.Models; using Dynamo.Visualization; using Dynamo.Wpf.Rendering; +using DynamoCoreWpfTests; using DynamoCoreWpfTests.Utility; -namespace DynamoCoreWpfTests +namespace DynamoPerformanceTests { ///