public void Start() { var writer = new StreamWriter($@"{AppDomain.CurrentDomain.BaseDirectory}\StressTest.txt");//заменено на относительный путь var kompas = StartKompas(); var builder = new DetailBuilder(kompas); var parameters = new GlassfulParametrs(1.0d, 10.0d, 10.0d, 1.0d, 8.0d); var count = 500; var processes = Process.GetProcessesByName("KOMPAS"); var process = processes.First(); var ramCounter = new PerformanceCounter("Process", "Working Set", process.ProcessName); var cpuCounter = new PerformanceCounter("Process", "% Processor Time", process.ProcessName); for (int i = 0; i < count; i++) { cpuCounter.NextValue(); builder.CreateDetail(parameters, false); var ram = ramCounter.NextValue(); var cpu = cpuCounter.NextValue(); writer.Write($"{i}. "); writer.Write($"RAM: {Math.Round(ram / 1024 / 1024)} MB"); writer.Write($"\tCPU: {cpu} %"); writer.Write(Environment.NewLine); writer.Flush(); } }
public void Start() { StartKompas(); var builder = new DetailBuilder(_kompas); var parameters = new Parameters(10, 30, 20, 10, 10, 20, "-");////////////////////////////////// var count = 1000; for (int i = 0; i < count; i++) { var processes = Process.GetProcessesByName("KOMPAS"); var process = processes.First(); if (i == 0) { _ramCounter = new PerformanceCounter("Process", "Working Set", process.ProcessName); _cpuCounter = new PerformanceCounter("Process", "% Processor Time", process.ProcessName); } _cpuCounter.NextValue(); builder.BuildDetail(parameters); var ram = _ramCounter.NextValue(); var cpu = _cpuCounter.NextValue(); _writer.Write($"{i}. "); _writer.Write($"RAM: {Math.Round(ram / 1024 / 1024)} MB"); _writer.Write($"\tCPU: {cpu} %"); _writer.Write(Environment.NewLine); _writer.Flush(); } }
private void BuildButton_Click(object sender, EventArgs e) { try { var parameters = new GlassfulParametrs(double.Parse(WallWidth.Text), double.Parse(HighDiameter.Text), double.Parse(HeightTextBox.Text), double.Parse(BottomThickness.Text), double.Parse(LowDiameter.Text)); _connector.OpenKompas(); var builder = new DetailBuilder(_connector.Kompas); builder.CreateDetail(parameters, FacetedGlassCheck.Checked); } catch (FormatException) { MessageBox.Show("Данные введены некоректно \nВозможно есть пустые поля или лишние запятые", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
/// <summary> /// Кнопка построения /// </summary> private void BuildButton_Click(object sender, EventArgs e) { try { Parameters parameters = new Parameters(Convert.ToDouble(diamBracingTextBox.Text), Convert.ToDouble(diamHeadTextBox.Text), Convert.ToDouble(diamLegTextBox.Text), Convert.ToDouble(lengthBracingTextBox.Text), Convert.ToDouble(lengthHeadTextBox.Text), Convert.ToDouble(lengthLegTextBox.Text), Convert.ToString(threadComboBox.Text)); if (_kompas != null) { DetailBuilder detailBuilder = new DetailBuilder(_kompas); detailBuilder.BuildDetail(parameters); } if (_kompas == null) { _kompasConnector.Connector(); _kompas = _kompasConnector.KompasObject; BuildButton.Enabled = true; DetailBuilder detailBuilder = new DetailBuilder(_kompas); detailBuilder.BuildDetail(parameters); } } catch (ArgumentException exeption) { MessageBox.Show(exeption.Message); } }
private void runInformationForm() { try { var item = (CacheTestMessage)treeViewLastRun.SelectedNode.Tag; var builder = new DetailBuilder(item); var details = builder.Text; var links = builder.Links; links.Insert(0, new AutoTest.UI.Link(details.IndexOf(item.Test.Name), details.IndexOf(item.Test.Name) + item.Test.Name.Length, item.Assembly, item.Test.Name)); showDetailsWindow(details, "Test output", links, Screen.PrimaryScreen.WorkingArea.Width > 1024 ? Screen.PrimaryScreen.WorkingArea.Width - 500 : Screen.PrimaryScreen.WorkingArea.Width); } catch { } }
private void linkLabelErrorDescription_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { var item = (CacheBuildMessage)listViewFeedback.SelectedItems[0].Tag; var builder = new DetailBuilder(item); var details = builder.Text; var links = builder.Links; showDetailsWindow(details, "Build output", links, Screen.PrimaryScreen.WorkingArea.Width > 1024 ? 1024 : Screen.PrimaryScreen.WorkingArea.Width); } catch { // Pft who logs!? } }
private void linkLabelTestDetails_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { var item = (CacheTestMessage)listViewFeedback.SelectedItems[0].Tag; var builder = new DetailBuilder(item); var details = builder.Text; var links = builder.Links; if (CanGoToTypes) { links.Insert(0, new Link(details.IndexOf(item.Test.Name), details.IndexOf(item.Test.Name) + item.Test.Name.Length, item.Assembly, item.Test.Name)); } showDetailsWindow(details, "Test output", links, Screen.PrimaryScreen.WorkingArea.Width > 1024 ? Screen.PrimaryScreen.WorkingArea.Width - 500 : Screen.PrimaryScreen.WorkingArea.Width); } catch { // Pft who logs!? } }
public string Build(LogMessage logMessage) { if (_clientDetails == null) { var clientDetailsBuilder = new ClientDetailsBuilder(); _clientDetails = clientDetailsBuilder.Build(_request); } DetailBuilder.Clear(); DetailBuilder.Append("<Details>"); DetailBuilder.Append(SessionDetailString(logMessage)); DetailBuilder.Append(TimeStampDetailString(logMessage)); DetailBuilder.Append(SequenceDetailString(logMessage)); DetailBuilder.Append(_clientDetails); DetailBuilder.Append(CreateMethodSourceInfoString(logMessage)); DetailBuilder.Append(UserSuppliedDetails(logMessage)); DetailBuilder.Append("</Details>"); return(DetailBuilder.ToString()); }
public string Build(string?requestBody = null) { DetailBuilder.Clear(); DetailBuilder.Append("<Request>"); try { var details = _requestDetailBuilder.GetDetails(); DetailBuilder.AppendFormat(DetailsFormat, details.Browser, details.ContentType, details.ContentLength, details.IsLocal, details.IsSecureConnection, details.UserHostAddress, details.UserHostName); } catch (System.Exception ex) { GC.KeepAlive(ex); #if DEBUG Log.Error(ex, "Loupe.Internal", "Unable to build standard Request details block due to " + ex.GetType(), "Exception occurred whilst trying to build the standard Request details block, no request will be added to detail\r\n{0}", ex.Message); #endif DetailBuilder.Append( "We were unable to record details from the Request itself due to an exception occurring whilst extracting information from the Request."); } if (requestBody != null) { DetailBuilder.Append("<RequestBody>" + requestBody + "</RequestBody>"); } DetailBuilder.Append("</Request>"); return(DetailBuilder.ToString()); }