private void RunAsync(object parameters) { var tuple = parameters as Tuple <string, string>; var script = tuple.Item1; var argument = tuple.Item2; var level = cbMode.SelectedItem.ToString() == "Release" ? DiagnosticAssemblyMode.Release : DiagnosticAssemblyMode.Debug; var platform = DiagnosticAssembyPlatform.x64; try { var assembly = engine.Compile(script, level, platform); string result = assembly.Execute(argument); string ilText = assembly.DumpIL(); UpdateIL(ilText); string asmText = assembly.DumpASM(); UpdateASM(asmText); UpdateLog("Script processing ended."); } catch (Exception ex) { UpdateLog(ex.ToString()); } }
private async Task <bool> RunAsync(string script, string argument, DiagnosticAssemblyMode level, DiagnosticAssembyPlatform platform) { try { var assembly = engine.Compile(script, level, platform); string result = assembly.Execute(argument); this.IlText = assembly.DumpIL(); this.AsmText = assembly.DumpASM(); var dataGen0 = assembly.HeapStatsData.Select(x => new DateViewModel() { DateTime = x.TimeStamp, Value = x.GenerationSize0, Tag = x }); var dataGen1 = assembly.HeapStatsData.Select(x => new DateViewModel() { DateTime = x.TimeStamp, Value = x.GenerationSize1, Tag = x }); var dataGen2 = assembly.HeapStatsData.Select(x => new DateViewModel() { DateTime = x.TimeStamp, Value = x.GenerationSize2, Tag = x }); var gcs = assembly.GcData.Select(x => new AxisSection() { SectionOffset = (double)x.TimeStamp.Subtract(TimeSpan.FromMilliseconds(1.0)).Ticks, SectionWidth = (double)TimeSpan.FromMilliseconds(1.0).Ticks }); var gcsLabels = assembly.GcData.Select(x => new VisualElement { X = (double)x.TimeStamp.Ticks, Y = 0.0, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, UIElement = new Button() { Content = x.Generation.ToString(), Background = Brushes.White } }); System.Windows.Application.Current.Dispatcher.Invoke(() => { var seriesGen0 = new LineSeries(mapper) { Title = "Gen0", LineSmoothness = 0, PointGeometry = DefaultGeometries.Circle, PointGeometrySize = 6 }; seriesGen0.Values = dataGen0.AsChartValues(); var seriesGen1 = new LineSeries(mapper) { Title = "Gen1", LineSmoothness = 0, PointGeometry = DefaultGeometries.Circle, PointGeometrySize = 6 }; seriesGen1.Values = dataGen1.AsChartValues(); var seriesGen2 = new LineSeries(mapper) { Title = "Gen2", LineSmoothness = 0, PointGeometry = DefaultGeometries.Circle, PointGeometrySize = 6 }; seriesGen2.Values = dataGen2.AsChartValues(); GraphDataGC.Clear(); GraphDataGC.Add(seriesGen0); GraphDataGC.Add(seriesGen1); GraphDataGC.Add(seriesGen2); GCSections.Clear(); GCSections.AddRange(gcs); GCSectionsLabels.Clear(); GCSectionsLabels.AddRange(gcsLabels); } ); this.GCEvents = new ObservableCollection <Core.Collectors.ClrEtwGcData>(assembly.GcData); this.RaisePropertyChanged(nameof(GCEvents)); // UpdateLog("Script processing ended."); return(true); } catch (Exception ex) { UpdateLog(ex.ToString()); return(false); } }