private void InitializeWorkloadAnalysis() { _baselineWorkloadAnalysis = new WorkloadAnalysis() { Name = "Baseline" }; _baselineWorkloadAnalysis.ConnectionInfo = new SqlConnectionInfo() { ServerName = _options.BaselineServer, DatabaseName = _options.BaselineDatabase, SchemaName = _options.BaselineSchema, UserName = _options.BaselineUsername, Password = _options.BaselinePassword }; _baselineWorkloadAnalysis.Load(); if (_options.BenchmarkSchema != null) { _benchmarkWorkloadAnalysis = new WorkloadAnalysis() { Name = "Benchmark" }; _benchmarkWorkloadAnalysis.ConnectionInfo = new SqlConnectionInfo() { ServerName = _options.BenchmarkServer, DatabaseName = _options.BenchmarkDatabase, SchemaName = _options.BenchmarkSchema, UserName = _options.BenchmarkUsername, Password = _options.BenchmarkPassword }; _benchmarkWorkloadAnalysis.Load(); } }
private Series LoadCpuSeries(WorkloadAnalysis analysis, OxyColor color, double baseOffset) { if (analysis == null) { return(null); } LineSeries cpuSeries = new LineSeries() { StrokeThickness = 2, MarkerSize = 3, MarkerStroke = OxyColor.Parse("#FF0000"), //Red MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, Title = analysis.Name, Color = color, Smooth = false }; if (baseOffset == 0) { cpuSeries.TrackerFormatString = "Offset: {2:0}\n{0}: {4:0}"; } var Table = from t in analysis.Points where ApplicationList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.ApplicationName) && HostList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.HostName) && DatabaseList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.DatabaseName) && LoginList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.LoginName) group t by new { offset = t.OffsetMinutes } into grp orderby grp.Key.offset select new { offset_minutes = grp.Key.offset, cpu = grp.Sum(t => t.SumCpuUs) }; foreach (var p in Table) { double xValue = 0; if (baseOffset > 0) { xValue = DateTimeAxis.ToDouble(DateTimeAxis.ToDateTime(baseOffset).AddMinutes(p.offset_minutes)); } else { xValue = p.offset_minutes; } cpuSeries.Points.Add(new DataPoint(xValue, p.cpu)); } return(cpuSeries); }
internal WorkloadAnalysisData Convert(WorkloadAnalysis source) { WorkloadAnalysisData result = new WorkloadAnalysisData(); result.CreatedDate = source.CreatedDate; result.EndDate = source.EndDate; result.ErrorMessage = source.ErrorMessage; result.ID = source.ID; result.PeriodFromDate = source.PeriodFromDate; result.PeriodToDate = source.PeriodToDate; result.StartDate = source.StartDate; result.State = (int)source.State; result.Workload = Convert(source.Workload); return(result); }
private Series LoadBatchesSeries(WorkloadAnalysis analysis, OxyColor color) { if (analysis == null) { return(null); } LineSeries batchesSeries = new LineSeries() { StrokeThickness = 2, MarkerSize = 3, MarkerStroke = OxyColor.Parse("#FF0000"), //Red MarkerType = MarkerType.None, CanTrackerInterpolatePoints = false, TrackerFormatString = "Offset: {2:0}\n{0}: {4:0}", Title = analysis.Name, Color = color, Smooth = false }; var Table = from t in analysis.Points where ApplicationList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.ApplicationName) && HostList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.HostName) && DatabaseList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.DatabaseName) && LoginList.Where(f => f.IsChecked).Select(f => f.Name).Contains(t.LoginName) group t by new { offset = t.OffsetMinutes } into grp orderby grp.Key.offset select new { offset_minutes = grp.Key.offset, execution_count = grp.Sum(t => t.ExecutionCount / ((t.DurationMinutes == 0 ? 1 : t.DurationMinutes) * 60)) }; foreach (var p in Table) { batchesSeries.Points.Add(new DataPoint(p.offset_minutes, p.execution_count)); } return(batchesSeries); }
internal WorkloadAnalysis CreateWorkloadAnalysis(CreateWorkloadAnalysisRequest source) { WorkloadAnalysis result = new WorkloadAnalysis(); result.CreatedDate = DateTime.Now; result.PeriodFromDate = source.PeriodFromDate; result.PeriodToDate = source.PeriodToDate; result.RelationReplacements = new List <WorkloadAnalysisRelationReplacement>(); if (source.RelationReplacements != null) { foreach (var kv in source.RelationReplacements) { result.RelationReplacements.Add(new WorkloadAnalysisRelationReplacement() { SourceId = kv.Key, TargetId = kv.Value }); } } result.State = WorkloadAnalysisStateType.Created; result.WorkloadID = source.WorkloadID; return(result); }