public void BreakTest() { breakTest = true; compute?.BreakExecution(); TestInterrupted = true; VmLocator.OnlineDb.SendPageHit("break"); ScreenOn.Disable(); }
public void StopTest() { stressTest?.Stop(); sw.Stop(); TestNotStarted = true; var label1 = string.Empty; if (stressTest.GflopsResults?.SmoothResults?.Count > 10 || stressTest.GflopsResults?.SmoothResults?.Count > 10) { label1 = VmLocator.L11n.First5Secs + ": {1:0.00} {0}\n" + VmLocator.L11n.Last5Secs + ": {2:0.00} {0}\n{3} {4:0.00}%"; } else { label1 = VmLocator.L11n.Start + ": {1:0.00} {0}\n" + VmLocator.L11n.End + ": {2:0.00} {0}\n{3} {4:0.00}%"; } var ss = new StressSummary() { SECONDS = Math.Round(sw.Elapsed.TotalSeconds, 2) }; if (stressTest.GflopsResults != null) { GflopsLabel = GetResultLabel(stressTest.GflopsResults, label1, "GFLOPS", out ss.FLT_START, out ss.FLT_END, out ss.FLT_DIFP); } if (stressTest.GinopsResults != null) { GinopsLabel = GetResultLabel(stressTest.GinopsResults, label1, "GINOPS", out ss.INT_START, out ss.INT_END, out ss.INT_DIFP); } if (Temp != null && Temp.Count > 2) { ss.TEMP_START = Temp[0]; ss.TEMP_END = Temp.Last(); ss.TEMP_DELT = Math.Round(ss.TEMP_END - ss.TEMP_START, 2); } RaisePropertyChanged(nameof(GflopsLabel)); RaisePropertyChanged(nameof(GinopsLabel)); RaisePropertyChanged(nameof(TempLabel)); if (di is IDisposable) { (di as IDisposable).Dispose(); // WPF CPU temp uses some hard staff for CPU temp monitoring } ScreenOn.Disable(); VmLocator.OnlineDb.SendPageHit("stressStop", ss); }
private void _window_Message(object sender, Message e) { // handler of console display state system event if (e.Msg == NativeMethods.WM_POWERBROADCAST) { if (e.WParam.ToInt32() == NativeMethods.PBT_POWERSETTINGCHANGE) { var s = (NativeMethods.POWERBROADCAST_SETTING)Marshal.PtrToStructure(e.LParam, typeof(NativeMethods.POWERBROADCAST_SETTING)); if (s.PowerSetting == NativeMethods.GUID_CONSOLE_DISPLAY_STATE) { switch (s.Data) { case 0x0: ScreenOff?.Invoke(this, null); break; case 0x1: ScreenOn?.Invoke(this, null); break; } } } } }
public void StartTest() { VmLocator.OnlineDb.SendPageHit("start"); ScreenOn.Enable(); const int iterations = 50 * 1000 * 1000; TestNotStarted = false; TestInterrupted = false; breakTest = false; ResetValues(); var options = VmLocator.Options; Task.Run(() => { try { compute.RunXops(iterations, inops: false, options.Float64Bit); RecentFloatSingleThreaded = breakTest ? (double?)null : compute.LastResultSTGigaOPSAveraged; Device.BeginInvokeOnMainThread(() => RaisePropertyChanged(nameof(RecentFloatSingleThreaded))); if (breakTest) { return; } compute.RunXops(iterations, inops: true, options.Int64Bit); RecentIntSingleThreaded = breakTest ? (double?)null : compute.LastResultSTGigaOPSAveraged; Device.BeginInvokeOnMainThread(() => RaisePropertyChanged(nameof(RecentIntSingleThreaded))); if (breakTest) { return; } compute.RunXopsMultiThreaded(iterations, options.FloatThreads, inops: false, precision64Bit: options.Float64Bit); RecentFloatMultiThreaded = breakTest ? (double?)null : compute.LastResultGigaOPS; Device.BeginInvokeOnMainThread(() => RaisePropertyChanged(nameof(RecentFloatMultiThreaded))); if (breakTest) { return; } compute.RunXopsMultiThreaded(iterations, options.IntThreads, inops: true, precision64Bit: options.Int64Bit); RecentIntMultiThreaded = breakTest ? (double?)null : compute.LastResultGigaOPS; Device.BeginInvokeOnMainThread(() => { RaisePropertyChanged(nameof(RecentIntMultiThreaded)); }); } catch { } finally { Device.BeginInvokeOnMainThread(() => { ScreenOn.Disable(); TestNotStarted = true; if (!breakTest && RecentFloatSingleThreaded.HasValue) { NumberOfRepeats++; sumFloatMultiThreaded += RecentFloatMultiThreaded.Value; sumFloatSingleThreaded += RecentFloatSingleThreaded.Value; sumIntMultiThreaded += RecentIntMultiThreaded.Value; sumIntSingleThreaded += RecentIntSingleThreaded.Value; FloatMultiThreaded = sumFloatMultiThreaded / NumberOfRepeats; RaisePropertyChanged(nameof(FloatMultiThreaded)); FloatSingleThreaded = sumFloatSingleThreaded / NumberOfRepeats; RaisePropertyChanged(nameof(FloatSingleThreaded)); IntMultiThreaded = sumIntMultiThreaded / NumberOfRepeats; RaisePropertyChanged(nameof(IntMultiThreaded)); IntSingleThreaded = sumIntSingleThreaded / NumberOfRepeats; RaisePropertyChanged(nameof(IntSingleThreaded)); RaisePropertyChanged(nameof(NumberOfRepeats)); RaisePropertyChanged(nameof(NumberOfRepeatsText)); VmLocator.QuickComparison.Compare.Execute(new SingleResult() { Value = FloatSingleThreaded.Value, Int = false, MultiThreaded = false }); VmLocator.OnlineDb.PreLoadComparison(this, VmLocator.Options); } }); } }); }
public void StartTest() { VmLocator.OnlineDb.SendPageHit("stressStart"); ScreenOn.Enable(); TestNotStarted = false; UpdateCounter = 0; stressTest = new Saplin.xOPS.StressTest(samplingMs, smoothing, warmUpSample, Environment.ProcessorCount, true, true); Gflops = stressTest.GflopsResults?.SmoothResults; Ginops = stressTest.GinopsResults?.SmoothResults; Temp = null; di = DependencyService.Get <IDeviceInfo>(); try { di.GetCpuTemp(); Temp = new List <double>(); RaisePropertyChanged(nameof(Temp)); } catch { } var tempText = string.Empty; if (Temp == null) { tempText = TempLabel = VmLocator.L11n.TempNotAvailable + (Device.RuntimePlatform == Device.WPF && !di.IsAdmin ? " - " + VmLocator.L11n.TryAdmin : "") + "\n"; } RaisePropertyChanged(nameof(Gflops)); RaisePropertyChanged(nameof(Ginops)); var label1 = VmLocator.L11n.Start + ": {1:0.00} {0}\n" + VmLocator.L11n.Now + ": {2:0.00} {0}"; var label2 = "{1:0.00} {0}\n{2:0.00}%"; var prevCount = 0; stressTest.ResultsUpdated += (e) => { if (stressTest.WarmpingUp) { GflopsLabel = GinopsLabel = Environment.ProcessorCount + " " + VmLocator.L11n.threads + " \n" + VmLocator.L11n.WarmingUp + "..."; TempLabel = VmLocator.L11n.WarmingUp + "..."; } else { var count = Gflops != null ? Gflops.Count : Ginops != null ? Ginops.Count : 0; if (prevCount != count) { prevCount = count; if (stressTest.GflopsResults != null) { GflopsLabel = UpdateCounter < 10 ? string.Format(label1, "GFLOPS", stressTest.GflopsResults.StartSmooth, stressTest.GflopsResults.CurrentSmooth) : string.Format(label2, "GFLOPS", stressTest.GflopsResults.CurrentSmooth, ((stressTest.GflopsResults.CurrentSmooth - stressTest.GflopsResults.StartSmooth) / stressTest.GflopsResults.StartSmooth * 100)); } if (stressTest.GinopsResults != null) { GinopsLabel = UpdateCounter < 14 ? string.Format(label1, "GINOPS", stressTest.GinopsResults.StartSmooth, stressTest.GinopsResults.CurrentSmooth) : string.Format(label2, "GINOPS", stressTest.GinopsResults.CurrentSmooth, ((stressTest.GinopsResults.CurrentSmooth - stressTest.GinopsResults.StartSmooth) / stressTest.GinopsResults.StartSmooth * 100)); } if (Temp != null) { try { var temp = di.GetCpuTemp(); Temp.Add(temp); tempText = "CPU " + temp.ToString("0.0") + "°C " + (temp > Temp[0] ? "↑" : "↓") + (temp - Temp[0]).ToString("0.0") + "°C"; } catch { }; } Update(); } TempLabel = tempText + "\n" + sw.Elapsed.Minutes + (UpdateCounter % 2 == 0 ? ":" : ".") + sw.Elapsed.Seconds.ToString("00");; } RaisePropertyChanged(nameof(GflopsLabel)); RaisePropertyChanged(nameof(GinopsLabel)); RaisePropertyChanged(nameof(TempLabel)); }; stressTest.Start(); sw.Restart(); }