예제 #1
0
        private void InteractWithUI(ref RamResults results, MainWindow ui)
        {
            string desc = results.Description;

            ui.Dispatcher.InvokeAsync(() => {
                ui.txtResults.AppendText($"Successfully ran the RAM test! Below is the " +
                                         $"results of the test.\n\n" +
                                         $"{desc}\n\n" +
                                         $"\n\n");
            });

            ui.Dispatcher.InvokeAsync(() => {
                ui.txtBlkResults.Text = "Results for the RAM test are below! If you would " +
                                        "like to send the results to the database, right click the results and press " +
                                        "send to database!";
            });

            ui.Dispatcher.InvokeAsync(() => {
                ui.ShowTabWindow(Tab.RESULTS);
                ui.btnRunTheTest.IsEnabled = true;
                ui.txtBlkRunningTest.Text  = "Are you sure you want to run this test?";
                ui.txtResults.ScrollToVerticalOffset(0);
                ui.txtBlkRunningTestTips.Visibility = System.Windows.Visibility.Hidden;
                ThemeManager.StopRunningTest();
            });
        }
예제 #2
0
        /// <summary>
        /// Runs each test <see cref="RipperSettings.IterationsPerRAMTest"/> times.
        /// <para>Should be (<see cref="RamResults.UniqueTestCount"/> *
        /// <see cref="RipperSettings.IterationsPerRAMTest"/>)
        /// timespans in <see cref="RamResults.TestCollection"/>.</para>
        /// </summary>
        /// <param name="results">The <see cref="RamResults"/> by reference
        /// to add the <see cref="TimeSpan"/>(s).</param>

        private void RunTestsSingle(ref RamResults results)
        {
            for (byte b = 0; b < this.rs.IterationsPerRAMTest; b++)
            {
                results.TestCollection.Add(RunVirtualFolderMatrix());
            }

            for (byte b = 0; b < this.rs.IterationsPerRAMTest; b++)
            {
                results.TestCollection.Add(RunVirtualBulkFile());
            }

            for (byte b = 0; b < this.rs.IterationsPerRAMTest; b++)
            {
                results.TestCollection.Add(RunReferenceDereference());
            }
        }
예제 #3
0
        /// <summary>
        /// Runs the benchmarking test on the RAM
        /// with a particular <see cref="ThreadType"/>.
        /// </summary>
        /// <param name="threadType">The type of threading
        /// for the test.</param>
        /// <param name="userData">The <see cref="UserData"/> thats passed
        /// into the instance for user information but is marked
        /// <see langword="readonly"/> internally.</param>
        /// <param name="ui">The <see cref="MainWindow"/> instance thats passed
        /// into for UI related tasks for updating components in it.</param>
        /// <returns>A new <see cref="RamResults"/> instance
        /// containing the result.</returns>
        /// <exception cref="RipperThreadException"></exception>

        public void RunRAMBenchmark(ThreadType threadType, ref UserData userData, MainWindow ui)
        {
            var results = new RamResults(this.rs, ref userData);

            switch (threadType)
            {
            case ThreadType.Single:
            {
                // runs task on main thread.
                RunTestsSingle(ref results);

                InteractWithUI(ref results, ui);

                break;
            }

            case ThreadType.SingleUI:
            {
                // runs task, but doesn't wait for result.

                void a()
                {
                    RunTestsSingleUI(ref results, ui);
                }

                Task task = new Task(a);

                task.Start();

                break;
            }

            case ThreadType.Multithreaded:
            {
                break;
            }

            default:
            {
                throw new RipperThreadException("Unknown thread type to call. " +
                                                "public RAMResults RunRAMBenchmark(ThreadType threadType) " +
                                                "in function.RamFunctions ");
            }
            }
        }
예제 #4
0
        /// <summary>
        /// Runs each test <see cref="RipperSettings.IterationsPerRAMTest"/> times.
        /// <para>Should be (<see cref="RamResults.UniqueTestCount"/> *
        /// <see cref="RipperSettings.IterationsPerRAMTest"/>)
        /// timespans in <see cref="RamResults.TestCollection"/>.</para>
        /// </summary>
        /// <param name="results">The <see cref="RamResults"/> by reference
        /// to add the <see cref="TimeSpan"/>(s).</param>

        private void RunTestsSingleUI(ref RamResults results, MainWindow ui)
        {
            for (byte b = 0; b < this.rs.IterationsPerRAMTest; b++)
            {
                results.TestCollection.Add(RunVirtualFolderMatrix());
            }

            for (byte b = 0; b < this.rs.IterationsPerRAMTest; b++)
            {
                results.TestCollection.Add(RunVirtualBulkFile());
            }

            for (byte b = 0; b < this.rs.IterationsPerRAMTest; b++)
            {
                results.TestCollection.Add(RunReferenceDereference());
            }

            InteractWithUI(ref results, ui);
        }