/// <summary>
        ///
        /// </summary>
        public async Task <AnalyzerStatistics> AnalyzeFromBatchAsync(string connectionStringBatch, string batchID)
        {
            #region Argument exception

            if (connectionStringBatch == null)
            {
                throw new ArgumentNullException("connectionStringBatch");
            }

            if (batchID == null)
            {
                throw new ArgumentNullException("batchID");
            }

            #endregion

            Func <AnalyzerStatistics> analyzeProcedure = () =>
            {
                ExecutionProgressControl?.StartMonitor_Batch();
                try
                {
                    return(AnalyzerStatistics.CreateFromAnalyzerBatchResults(connectionStringBatch, batchID));
                }
                finally
                {
                    ExecutionProgressControl?.StopMonitor_Batch();
                }
            };

            using (var task = Task.Factory.StartNew(analyzeProcedure))
                return(await task.ConfigureAwait(continueOnCapturedContext : false));
        }
        public void UpdateStatistics(AnalyzerStatistics analyzerStatistics)
        {
            _analyzerStatistics = analyzerStatistics;

            _coldTotalEventsCounter = _analyzerStatistics.ColdCacheExecutionResult.Profilers
                                      .SelectMany((p) => p.ToList())
                                      .Count();

            _warmTotalEventsCounter = _analyzerStatistics.WarmCacheExecutionResult.Profilers
                                      .SelectMany((p) => p.ToList())
                                      .Count();

            dataGridViewColdCache.DataSource = _analyzerStatistics.ColdCacheExecutionResult.Profilers
                                               .SelectMany((p) => p.ToList())
                                               .OrderBy((p) => p.ID)
                                               .ToSortableBindingList();
            dataGridViewColdCache.HideEmptyColumns();

            dataGridViewWarmCache.DataSource = _analyzerStatistics.WarmCacheExecutionResult.Profilers
                                               .SelectMany((p) => p.ToList())
                                               .OrderBy((p) => p.ID)
                                               .ToSortableBindingList();
            dataGridViewWarmCache.HideEmptyColumns();

            RefreshClassFilter();
            RefreshSubclassFilter();
            InitializeContextMenuStrips();

            pictureBoxMessage.Image = SystemIcons.Information.ToBitmap();
        }
Esempio n. 3
0
 public void UpdateStatistics(AnalyzerStatistics analyzerStatistics)
 {
     resultPresenterAnalyzerResultEngineUsageControl1.UpdateStatistics(analyzerStatistics);
     resultPresenterAnalyzerResultDataRetrieveControl1.UpdateStatistics(analyzerStatistics);
     resultPresenterAnalyzerResultResourceUsageControl1.UpdateStatistics(analyzerStatistics);
     resultPresenterAnalyzerResultPerformanceCounterControl1.UpdateStatistics(analyzerStatistics);
     resultPresenterAnalyzerResultTimelineControl1.UpdateStatistics(analyzerStatistics);
     resultPresenterTraceEventsControl1.UpdateStatistics(analyzerStatistics);
 }
        public void UpdateStatistics(AnalyzerStatistics analyzerStatistics)
        {
            if (!BuildGridView(dataGridViewColdCache, analyzerStatistics.ColdCacheExecutionResult.QueryResults))
            {
                dataGridViewColdCache.DataSource = analyzerStatistics.ColdCacheExecutionResult.QueryResults;
            }

            if (!BuildGridView(dataGridViewWarmCache, analyzerStatistics.WarmCacheExecutionResult.QueryResults))
            {
                dataGridViewWarmCache.DataSource = analyzerStatistics.WarmCacheExecutionResult.QueryResults;
            }
        }
        /// <summary>
        /// Execute server-side AnalyzeBatch procedure
        /// </summary>
        public async Task <AnalyzerStatistics> AnalyzeBatchAsync(string connectionStringBatch, string statement, ClearCacheMode clearCacheMode = ClearCacheMode.Default, string xconfig = null, string batchName = null, bool throwOnError = true)
        {
            #region Argument exception

            if (connectionStringBatch == null)
            {
                throw new ArgumentNullException("connectionStringBatch");
            }

            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            #endregion

            var currentProcess = Process.GetCurrentProcess();
            var processName    = currentProcess.ProcessName;
            var clientVersion  = "{0} ({1})".FormatWith(currentProcess.MainModule.FileVersionInfo.FileVersion, ClientVersion);

#if DEBUG
            Func <Guid, ClearCacheMode, string> commandAnalyze = (batchID, cacheMode) => "call {0}.AnalyzeBatchWithDebug(\"{1}\", {2}, \"{3}\", \"{4}\", \"{5}\", \"{6}\", \"{7}\", \"{8}\");".FormatWith(ClrAssemblyID, statement.EscapeMdxString(), (int)cacheMode, batchID, connectionStringBatch.EscapeMdxString(), clientVersion, processName, batchName, throwOnError);
#else
            Func <Guid, ClearCacheMode, string> commandAnalyze = (batchID, cacheMode) => "call {0}.AnalyzeBatch(\"{1}\", {2}, \"{3}\", \"{4}\", \"{5}\", \"{6}\", \"{7}\", \"{8}\");".FormatWith(ClrAssemblyID, statement.EscapeMdxString(), (int)cacheMode, batchID, connectionStringBatch.EscapeMdxString(), clientVersion, processName, batchName, throwOnError);
#endif
            Func <AnalyzerStatistics> analyzeProcedure = () =>
            {
                ExecutionProgressControl?.StartMonitor_Batch();
                try
                {
                    var batchID = Guid.NewGuid();

                    var coldCacheExecutionResult = AnalysisServicesHelper.ExecuteForDataSet(_connectionString, commandAnalyze(batchID, clearCacheMode), _cancellationTokenSource.Token).ToAnalyzerExecutionResult(dispose: true);
                    var warmCacheExecutionResult = AnalysisServicesHelper.ExecuteForDataSet(_connectionString, commandAnalyze(batchID, ClearCacheMode.Nothing), _cancellationTokenSource.Token).ToAnalyzerExecutionResult(dispose: true);

                    return(AnalyzerStatistics.CreateFromAnalyzerExecutionResults(coldCacheExecutionResult, warmCacheExecutionResult));
                }
                finally
                {
                    ExecutionProgressControl?.StopMonitor_Batch();
                }
            };

            using (_cancellationTokenSource = new CancellationTokenSource())
            {
                using (var task = Task.Factory.StartNew(analyzeProcedure))
                    return(await task.ConfigureAwait(continueOnCapturedContext : false));
            }
        }
        /// <summary>
        /// Load Xml debug file
        /// </summary>
        public async Task <AnalyzerStatistics> AnalyzeFromDebugAsync(string coldCacheDebugFile, string warmCacheDebugFile)
        {
            #region Argument exception

            if (coldCacheDebugFile == null)
            {
                throw new ArgumentNullException("coldCacheDebugFile");
            }

            if (warmCacheDebugFile == null)
            {
                throw new ArgumentNullException("warmCacheDebugFile");
            }

            #endregion

            Func <AnalyzerStatistics> analyzeProcedure = () =>
            {
                AnalyzerExecutionResult coldCacheExecutionResult;
                AnalyzerExecutionResult warmCacheExecutionResult;

                using (var data = new DataSet())
                {
                    data.ReadXml(coldCacheDebugFile, XmlReadMode.ReadSchema);
                    coldCacheExecutionResult = data.ToAnalyzerExecutionResult(dispose: true);
                }

                using (var data = new DataSet())
                {
                    data.ReadXml(warmCacheDebugFile, XmlReadMode.ReadSchema);
                    warmCacheExecutionResult = data.ToAnalyzerExecutionResult(dispose: true);
                }

                return(AnalyzerStatistics.CreateFromAnalyzerExecutionResults(coldCacheExecutionResult, warmCacheExecutionResult));
            };

            using (var task = Task.Factory.StartNew(analyzeProcedure))
                return(await task.ConfigureAwait(continueOnCapturedContext : false));
        }
Esempio n. 7
0
        public void UpdateStatistics(AnalyzerStatistics analyzerStatistics)
        {
            labelWarmCacheExecutionImprovementPercentage.Text = "WARM execution improvement: {0:0.00} %".FormatWith(analyzerStatistics.EngineUsageWarmCacheExecutionImprovementPercentage);

            labelColdCacheQueryDuration.Text         = "Query duration: {0}".FormatWith(analyzerStatistics.EngineUsageColdCacheQueryDuration.ToFormattedTime());
            labelColdCacheFormulaEngineDuration.Text = "FE duration: {0}".FormatWith(analyzerStatistics.EngineUsageColdCacheFormulaEngineDuration.ToFormattedTime());
            labelColdCacheStorageEngineDuration.Text = "SE duration: {0}".FormatWith(analyzerStatistics.EngineUsageColdCacheStorageEngineDuration.ToFormattedTime());

            labelWarmCacheQueryDuration.Text         = "Query duration: {0}".FormatWith(analyzerStatistics.EngineUsageWarmCacheQueryDuration.ToFormattedTime());
            labelWarmCacheFormulaEngineDuration.Text = "FE duration: {0}".FormatWith(analyzerStatistics.EngineUsageWarmCacheFormulaEngineDuration.ToFormattedTime());
            labelWarmCacheStorageEngineDuration.Text = "SE duration: {0}".FormatWith(analyzerStatistics.EngineUsageWarmCacheStorageEngineDuration.ToFormattedTime());

            #region assert
            Debug.Assert(chartColdCache.Series.Count == 1);
            Debug.Assert(chartColdCache.Series[0].Points.Count == 2);
            Debug.Assert(chartColdCache.Series[0].Points[0].LegendText == "Formula Engine");
            Debug.Assert(chartColdCache.Series[0].Points[1].LegendText == "Storage Engine");
            #endregion
            var coldCacheSerie = chartColdCache.Series[0];
            {
                coldCacheSerie.Points[0].SetValueY(analyzerStatistics.EngineUsageColdCacheFormulaEngineDuration.Ticks);
                coldCacheSerie.Points[1].SetValueY(analyzerStatistics.EngineUsageColdCacheStorageEngineDuration.Ticks);
            }

            #region assert
            Debug.Assert(chartWarmCache.Series.Count == 1);
            Debug.Assert(chartWarmCache.Series[0].Points.Count == 2);
            Debug.Assert(chartWarmCache.Series[0].Points[0].LegendText == "Formula Engine");
            Debug.Assert(chartWarmCache.Series[0].Points[1].LegendText == "Storage Engine");
            #endregion
            var warmCacheSerie = chartWarmCache.Series[0];
            {
                warmCacheSerie.Points[0].SetValueY(analyzerStatistics.EngineUsageWarmCacheFormulaEngineDuration.Ticks);
                warmCacheSerie.Points[1].SetValueY(analyzerStatistics.EngineUsageWarmCacheStorageEngineDuration.Ticks);
            }

            InitializeContextMenuStrips();
        }
 /// <summary>
 ///
 /// </summary>
 public Control BuildRawResultControl(AnalyzerStatistics analyzerStatistics)
 {
     return(AnalyzerExecutionResultHelper.BuildRawResultControl(analyzerStatistics));
 }
        /// <summary>
        /// Execute server-side Analyze procedure
        /// </summary>
        public async Task <AnalyzerStatistics> AnalyzeAsync(string statement, ClearCacheMode clearCacheMode = ClearCacheMode.Default, int queryResultRowLimit = 0)
        {
            #region Argument exception

            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            #endregion

            var currentProcess = Process.GetCurrentProcess();
            var processName    = currentProcess.ProcessName;
            var clientVersion  = "{0} ({1})".FormatWith(currentProcess.MainModule.FileVersionInfo.FileVersion, ClientVersion);

#if DEBUG
            Func <ClearCacheMode, string> commandAnalyze = (cacheMode) => "call {0}.AnalyzeWithDebug(\"{1}\", {2}, {3}, \"{4}\", \"{5}\");".FormatWith(ClrAssemblyID, statement.EscapeMdxString(), (int)cacheMode, queryResultRowLimit, clientVersion, processName);
#else
            Func <ClearCacheMode, string> commandAnalyze = (cacheMode) => "call {0}.Analyze(\"{1}\", {2}, {3}, \"{4}\", \"{5}\");".FormatWith(ClrAssemblyID, statement.EscapeMdxString(), (int)cacheMode, queryResultRowLimit, clientVersion, processName);
#endif
            Action <DataSet, string> saveDebug = (data, dbgType) =>
            {
                if (!DebugToXml)
                {
                    return;
                }

                var debugPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"SSASQueryAnalyzer\debug");
                Directory.CreateDirectory(debugPath);
                data.WriteXml(Path.Combine(debugPath, "AnalyzerExecutionResult-{0:yyyyMMdd-hhmmss-fff}.{1}").FormatWith(DateTime.Now, dbgType), XmlWriteMode.WriteSchema);
            };

            Func <AnalyzerStatistics> analyzeProcedure = () =>
            {
                ExecutionProgressControl?.StartMonitor();
                try
                {
                    AnalyzerExecutionResult coldCacheExecutionResult;
                    AnalyzerExecutionResult warmCacheExecutionResult;

                    using (var data = AnalysisServicesHelper.ExecuteForDataSet(_connectionString, commandAnalyze(clearCacheMode), _cancellationTokenSource.Token))
                    {
                        saveDebug(data, "xqac");
                        coldCacheExecutionResult = data.ToAnalyzerExecutionResult(dispose: true);
                    }

                    ExecutionProgressControl?.ColdCacheExecutionCompleted();

                    using (var data = AnalysisServicesHelper.ExecuteForDataSet(_connectionString, commandAnalyze(ClearCacheMode.Nothing), _cancellationTokenSource.Token))
                    {
                        saveDebug(data, "xqaw");
                        warmCacheExecutionResult = data.ToAnalyzerExecutionResult(dispose: true);
                    }

                    ExecutionProgressControl?.WarmCacheExecutionCompleted();

                    return(AnalyzerStatistics.CreateFromAnalyzerExecutionResults(coldCacheExecutionResult, warmCacheExecutionResult));
                }
                finally
                {
                    ExecutionProgressControl?.StopMonitor();
                }
            };

            using (_cancellationTokenSource = new CancellationTokenSource())
            {
                using (var task = Task.Factory.StartNew(analyzeProcedure))
                    return(await task.ConfigureAwait(continueOnCapturedContext : false));
            }
        }
        private ResultPresenterControl(AnalyzerStatistics analyzerStatistics, bool liveMode, bool batchMode, bool loadBatchMode)
        {
            #region Argument exception

            if (analyzerStatistics == null)
            {
                throw new ArgumentNullException("analyzerStatistics");
            }

            #endregion

            InitializeComponent();

            Debug.Assert(liveMode ^ (batchMode || loadBatchMode));

            _analyzerStatistics = analyzerStatistics;

            tabControlAnalyzerResult.TabPages.Remove(tabPageQueryResult);
            tabControlAnalyzerResult.TabPages.Remove(tabPageAnalysisResult);
            tabControlAnalyzerResult.TabPages.Remove(tabPageAnalysisInfo);
            tabControlAnalyzerResult.TabPages.Remove(tabPageAbout);

            if (tabControlAnalyzerResult.TabCount > 0)
            {
                tabControlAnalyzerResult.SelectedIndex = 0;
            }

            var renderingBegin = DateTime.UtcNow;

            if (liveMode)
            {
                #region Query Result tab

                if (analyzerStatistics.ColdCacheExecutionResult.QueryResults.Rows.Count > 0 || analyzerStatistics.WarmCacheExecutionResult.QueryResults.Rows.Count > 0)
                {
                    resultPresenterQueryResultControl1.UpdateStatistics(_analyzerStatistics);
                    tabControlAnalyzerResult.TabPages.Add(tabPageQueryResult);
                    tabPageQueryResult.Visible = true;
                }

                #endregion
            }

            if (liveMode || loadBatchMode)
            {
                #region Analyzer Result tab
                resultPresenterAnalyzerResultControl1.UpdateStatistics(_analyzerStatistics);
                tabControlAnalyzerResult.TabPages.Add(tabPageAnalysisResult);
                tabPageAnalysisResult.Visible = true;
                #endregion
            }

            #region Analysis Info tab
            resultPresenterExecutionInfoControl1.UpdateStatistics(_analyzerStatistics, liveMode, batchMode, loadBatchMode, renderingBegin);
            if (tabControlAnalyzerResult.TabCount > 0)
            {
                tabControlAnalyzerResult.TabPages.Insert(0, tabPageAnalysisInfo);
            }
            else
            {
                tabControlAnalyzerResult.TabPages.Add(tabPageAnalysisInfo);
            }
            tabControlAnalyzerResult.SelectedIndex = 0;
            tabPageAnalysisInfo.Visible            = true;
            #endregion

            #region About tab
            tabControlAnalyzerResult.TabPages.Add(tabPageAbout);
            tabPageAbout.Visible = true;
            #endregion

            Dock = DockStyle.Fill;
        }
Esempio n. 11
0
 public void UpdateStatistics(AnalyzerStatistics analyzerStatistics)
 {
     // TO DO
 }
        public void UpdateStatistics(AnalyzerStatistics analyzerStatistics)
        {
            // dictionary structure: (<MDXStudioName>,<PerformanceCounterName>)
            performanceCountersTranslation.Add("Calc covers", "Number of calculation covers");
            performanceCountersTranslation.Add("Cells calculated", "Total cells calculated");
            performanceCountersTranslation.Add("Sonar subcubes", "Total sonar subcubes");
            performanceCountersTranslation.Add("NON EMPTYs", "Total NON EMPTY");
            performanceCountersTranslation.Add("Autoexists", "Total Autoexist");
            performanceCountersTranslation.Add("EXISTINGS", "Total EXISTING");
            performanceCountersTranslation.Add("SE queries", "Total measure group queries");
            performanceCountersTranslation.Add("Flat cache insert", "Total flat cache inserts");
            performanceCountersTranslation.Add("Cache hits", "Total direct hits");
            performanceCountersTranslation.Add("Cache misses", "Total misses");
            performanceCountersTranslation.Add("Cache inserts", "Total inserts");
            performanceCountersTranslation.Add("Cache lookups", "Total lookups");
            performanceCountersTranslation.Add("Memory usage KB", "Memory usage KB");

            #region assert
            Debug.Assert(chartColdCache.Series.Count == 1);
            Debug.Assert(chartColdCache.Series[0].Points.Count == 13);
            Debug.Assert(chartColdCache.Series[0].Points[0].LegendText == "Memory usage KB");
            Debug.Assert(chartColdCache.Series[0].Points[1].LegendText == "Cache lookups");
            Debug.Assert(chartColdCache.Series[0].Points[2].LegendText == "Cache inserts");
            Debug.Assert(chartColdCache.Series[0].Points[3].LegendText == "Cache misses");
            Debug.Assert(chartColdCache.Series[0].Points[4].LegendText == "Cache hits");
            Debug.Assert(chartColdCache.Series[0].Points[5].LegendText == "Flat cache insert");
            Debug.Assert(chartColdCache.Series[0].Points[6].LegendText == "SE queries");
            Debug.Assert(chartColdCache.Series[0].Points[7].LegendText == "EXISTINGS");
            Debug.Assert(chartColdCache.Series[0].Points[8].LegendText == "Autoexists");
            Debug.Assert(chartColdCache.Series[0].Points[9].LegendText == "NON EMPTYs");
            Debug.Assert(chartColdCache.Series[0].Points[10].LegendText == "Sonar subcubes");
            Debug.Assert(chartColdCache.Series[0].Points[11].LegendText == "Cells calculated");
            Debug.Assert(chartColdCache.Series[0].Points[12].LegendText == "Calc covers");
            #endregion

            var coldCacheSerie = chartColdCache.Series[0];
            {
                coldCacheSerie.Points[1].SetValueY(analyzerStatistics.PerformanceCountersColdCacheCacheTotalLookups);
                coldCacheSerie.Points[2].SetValueY(analyzerStatistics.PerformanceCountersColdCacheCacheTotalInserts);
                coldCacheSerie.Points[3].SetValueY(analyzerStatistics.PerformanceCountersColdCacheCacheTotalMisses);
                coldCacheSerie.Points[4].SetValueY(analyzerStatistics.PerformanceCountersColdCacheCacheTotalDirectHits);
                coldCacheSerie.Points[5].SetValueY(analyzerStatistics.PerformanceCountersColdCacheMdxTotalFlatCacheInserts);
                coldCacheSerie.Points[6].SetValueY(analyzerStatistics.PerformanceCountersColdCacheStorageEngineQueryTotalMeasureGroupQueries);
                coldCacheSerie.Points[7].SetValueY(analyzerStatistics.PerformanceCountersColdCacheMdxTotalExisting);
                coldCacheSerie.Points[8].SetValueY(analyzerStatistics.PerformanceCountersColdCacheMdxTotalAutoexist);
                coldCacheSerie.Points[9].SetValueY(analyzerStatistics.PerformanceCountersColdCacheMdxTotalNonEmpty);
                coldCacheSerie.Points[10].SetValueY(analyzerStatistics.PerformanceCountersColdCacheMdxTotalSonarSubcubes);
                coldCacheSerie.Points[11].SetValueY(analyzerStatistics.PerformanceCountersColdCacheMdxTotalCellsCalculated);
                coldCacheSerie.Points[12].SetValueY(analyzerStatistics.PerformanceCountersColdCacheMdxNumberOfCalculationCovers);

                var value = analyzerStatistics.PerformanceCountersColdCacheMemoryMemoryUsageKB;
                if (value < 0L)
                {
                    coldCacheSerie.Points[0].Label = string.Format("{0:n0}", value);
                    coldCacheSerie.Points[0].SetValueY(0L);
                }
                else
                {
                    coldCacheSerie.Points[0].Label = "#VAL{N0}";
                    coldCacheSerie.Points[0].SetValueY(value);
                }
            }

            #region assert
            Debug.Assert(chartWarmCache.Series.Count == 1);
            Debug.Assert(chartWarmCache.Series[0].Points.Count == 13);
            Debug.Assert(chartWarmCache.Series[0].Points[0].LegendText == "Memory usage KB");
            Debug.Assert(chartWarmCache.Series[0].Points[1].LegendText == "Cache lookups");
            Debug.Assert(chartWarmCache.Series[0].Points[2].LegendText == "Cache inserts");
            Debug.Assert(chartWarmCache.Series[0].Points[3].LegendText == "Cache misses");
            Debug.Assert(chartWarmCache.Series[0].Points[4].LegendText == "Cache hits");
            Debug.Assert(chartWarmCache.Series[0].Points[5].LegendText == "Flat cache insert");
            Debug.Assert(chartWarmCache.Series[0].Points[6].LegendText == "SE queries");
            Debug.Assert(chartWarmCache.Series[0].Points[7].LegendText == "EXISTINGS");
            Debug.Assert(chartWarmCache.Series[0].Points[8].LegendText == "Autoexists");
            Debug.Assert(chartWarmCache.Series[0].Points[9].LegendText == "NON EMPTYs");
            Debug.Assert(chartWarmCache.Series[0].Points[10].LegendText == "Sonar subcubes");
            Debug.Assert(chartWarmCache.Series[0].Points[11].LegendText == "Cells calculated");
            Debug.Assert(chartWarmCache.Series[0].Points[12].LegendText == "Calc covers");
            #endregion

            var warmCacheSerie = chartWarmCache.Series[0];
            {
                warmCacheSerie.Points[1].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheCacheTotalLookups);
                warmCacheSerie.Points[2].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheCacheTotalInserts);
                warmCacheSerie.Points[3].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheCacheTotalMisses);
                warmCacheSerie.Points[4].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheCacheTotalDirectHits);
                warmCacheSerie.Points[5].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheMdxTotalFlatCacheInserts);
                warmCacheSerie.Points[6].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheStorageEngineQueryTotalMeasureGroupQueries);
                warmCacheSerie.Points[7].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheMdxTotalExisting);
                warmCacheSerie.Points[8].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheMdxTotalAutoexist);
                warmCacheSerie.Points[9].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheMdxTotalNonEmpty);
                warmCacheSerie.Points[10].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheMdxTotalSonarSubcubes);
                warmCacheSerie.Points[11].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheMdxTotalCellsCalculated);
                warmCacheSerie.Points[12].SetValueY(analyzerStatistics.PerformanceCountersWarmCacheMdxNumberOfCalculationCovers);

                var value = analyzerStatistics.PerformanceCountersWarmCacheMemoryMemoryUsageKB;
                if (value < 0L)
                {
                    warmCacheSerie.Points[0].Label = string.Format("{0:n0}", value);
                    warmCacheSerie.Points[0].SetValueY(0L);
                }
                else
                {
                    warmCacheSerie.Points[0].Label = "#VAL{N0}";
                    warmCacheSerie.Points[0].SetValueY(value);
                }
            }

            foreach (var chart in new[] { chartColdCache, chartWarmCache })
            {
                var serie = chart.Series[0];

                foreach (var point in serie.Points)
                {
                    if (point.YValues.Single() == 0D)
                    {
                        point.IsEmpty = true;
                    }

                    if (point.IsEmpty)
                    {
                        point.Label = " ";
                    }
                }

                if (serie.Points.All((p) => p.IsEmpty))
                {
                    chart.ChartAreas[0].Axes[1].IsLogarithmic = false;
                }
            }

            InitializeContextMenuStrips();

            pictureBoxMessage.Image = SystemIcons.Information.ToBitmap();
        }
Esempio n. 13
0
        public void UpdateStatistics(AnalyzerStatistics analyzerStatistics, bool liveMode, bool batchMode, bool loadBatchMode, DateTime renderingBegin)
        {
            InitializeContextMenuStrips();
            pictureBoxMessage.Image = SystemIcons.Information.ToBitmap();

            _analyzerStatistics = analyzerStatistics;

            _liveMode       = liveMode;
            _batchMode      = batchMode;
            _loadBatchMode  = loadBatchMode;
            _renderingBegin = renderingBegin;

            if (_loadBatchMode)
            {
                tableLayoutExecution.RowStyles[2].Height = 0;

                _analysisEnd      = _analyzerStatistics.WarmCacheExecutionResult.ExecutionEndTime;
                _analysisBegin    = _analyzerStatistics.ColdCacheExecutionResult.ExecutionStartTime;
                _analysisDuration = _analysisEnd.Subtract(_analysisBegin);

                labelExecutionTypeValue.Text = "Batch Mode - Loaded from ASQA database";
                labelExecutionIDValue.Text   = "[{0}]".FormatWith(_analyzerStatistics.ColdCacheExecutionResult.BatchID);
                pictureExecutionMode.Image   = Properties.Resources.LoadFromDB_16x16;
                // Load ASQA SSAS Assembly details when in loadBatchMode
                LoadASQAAssemblyConfiguration();
                UpdateLabelMessage();
            }
            else
            {
                if (_analyzerStatistics.ColdCacheExecutionResult.ProcedureEvents == null || _analyzerStatistics.ColdCacheExecutionResult.ProcedureEvents.Count == 0 ||
                    _analyzerStatistics.WarmCacheExecutionResult.ProcedureEvents == null || _analyzerStatistics.WarmCacheExecutionResult.ProcedureEvents.Count == 0)
                {
                    return;
                }

                _analysisEnd      = DateTime.UtcNow;
                _analysisBegin    = _analyzerStatistics.ColdCacheExecutionResult.ProcedureEvents[ProcedureEvents.ProcedureAnalyzeBegin].Time;
                _analysisDuration = _analysisEnd.Subtract(_analysisBegin);

                if (_liveMode)
                {
                    labelExecutionTypeValue.Text = "Live Mode";
                    labelExecutionIDValue.Text   = "[{0}]".FormatWith(_analyzerStatistics.ColdCacheExecutionResult.BatchID);
                    pictureExecutionMode.Image   = Properties.Resources.LiveMode_16x16;
                    tabControlEnvironmentDetails.TabPages.Remove(tabPageSQLServer);
                    tabControlEnvironmentDetails.TabPages.Remove(tabPageASQASSASAssembly);
                }
                else if (_batchMode)
                {
                    labelExecutionTypeValue.Text = "Batch Mode";
                    labelExecutionIDValue.Text   = "[{0}]".FormatWith(_analyzerStatistics.ColdCacheExecutionResult.BatchID);
                    pictureExecutionMode.Image   = Properties.Resources.BatchMode_16x16;
                    tabControlEnvironmentDetails.TabPages.Remove(tabPageASQASSASAssembly);
                }

                // Load Activities details when not in loadBatchMode
                LoadActivity();
            }

            LoadIniFile();
            LoadCubeMetadata();
            LoadExecutionInfo();
        }
Esempio n. 14
0
        public void UpdateStatistics(AnalyzerStatistics analyzerStatistics)
        {
            #region assert
            Debug.Assert(chartColdCache.Series.Count == 1);
            Debug.Assert(chartColdCache.Series[0].Points.Count == 7);
            Debug.Assert(chartColdCache.Series[0].Points[0].LegendText == "Reads");
            Debug.Assert(chartColdCache.Series[0].Points[1].LegendText == "Read KB");
            Debug.Assert(chartColdCache.Series[0].Points[2].LegendText == "Writes");
            Debug.Assert(chartColdCache.Series[0].Points[3].LegendText == "Write KB");
            Debug.Assert(chartColdCache.Series[0].Points[4].LegendText == "CPU Time MS");
            Debug.Assert(chartColdCache.Series[0].Points[5].LegendText == "Rows Scanned");
            Debug.Assert(chartColdCache.Series[0].Points[6].LegendText == "Rows Returned");
            #endregion
            var coldCacheSerie = chartColdCache.Series[0];
            {
                coldCacheSerie.Points[0].SetValueY(analyzerStatistics.ResourceUsageColdCacheReads);
                coldCacheSerie.Points[1].SetValueY(analyzerStatistics.ResourceUsageColdCacheReadKB);
                coldCacheSerie.Points[2].SetValueY(analyzerStatistics.ResourceUsageColdCacheWrites);
                coldCacheSerie.Points[3].SetValueY(analyzerStatistics.ResourceUsageColdCacheWriteKB);
                coldCacheSerie.Points[4].SetValueY(analyzerStatistics.ResourceUsageColdCacheCpuTimeMS);
                coldCacheSerie.Points[5].SetValueY(analyzerStatistics.ResourceUsageColdCacheRowsScanned);
                coldCacheSerie.Points[6].SetValueY(analyzerStatistics.ResourceUsageColdCacheRowsReturned);
            }

            #region assert
            Debug.Assert(chartWarmCache.Series.Count == 1);
            Debug.Assert(chartWarmCache.Series[0].Points.Count == 7);
            Debug.Assert(chartWarmCache.Series[0].Points[0].LegendText == "Reads");
            Debug.Assert(chartWarmCache.Series[0].Points[1].LegendText == "Read KB");
            Debug.Assert(chartWarmCache.Series[0].Points[2].LegendText == "Writes");
            Debug.Assert(chartWarmCache.Series[0].Points[3].LegendText == "Write KB");
            Debug.Assert(chartWarmCache.Series[0].Points[4].LegendText == "CPU Time MS");
            Debug.Assert(chartWarmCache.Series[0].Points[5].LegendText == "Rows Scanned");
            Debug.Assert(chartWarmCache.Series[0].Points[6].LegendText == "Rows Returned");
            #endregion
            var warmCacheSerie = chartWarmCache.Series[0];
            {
                warmCacheSerie.Points[0].SetValueY(analyzerStatistics.ResourceUsageWarmCacheReads);
                warmCacheSerie.Points[1].SetValueY(analyzerStatistics.ResourceUsageWarmCacheReadKB);
                warmCacheSerie.Points[2].SetValueY(analyzerStatistics.ResourceUsageWarmCacheWrites);
                warmCacheSerie.Points[3].SetValueY(analyzerStatistics.ResourceUsageWarmCacheWriteKB);
                warmCacheSerie.Points[4].SetValueY(analyzerStatistics.ResourceUsageWarmCacheCpuTimeMS);
                warmCacheSerie.Points[5].SetValueY(analyzerStatistics.ResourceUsageWarmCacheRowsScanned);
                warmCacheSerie.Points[6].SetValueY(analyzerStatistics.ResourceUsageWarmCacheRowsReturned);
            }

            foreach (var chart in new[] { chartColdCache, chartWarmCache })
            {
                var serie = chart.Series[0];

                foreach (var point in serie.Points)
                {
                    if (point.YValues.Single() == 0D)
                    {
                        point.IsEmpty = true;
                    }

                    if (point.IsEmpty)
                    {
                        point.Label = " ";
                    }
                }

                if (serie.Points.All((p) => p.IsEmpty))
                {
                    chart.ChartAreas[0].Axes[1].IsLogarithmic = false;
                }
            }

            InitializeContextMenuStrips();

            pictureBoxMessage.Image = SystemIcons.Information.ToBitmap();
        }
 /// <summary>
 ///
 /// </summary>
 public Control BuildResultControl(AnalyzerStatistics analyzerStatistics)
 {
     return(ResultPresenterControl.Create(analyzerStatistics));
 }
 /// <summary>
 ///
 /// </summary>
 public Control BuildLoadBatchResultControl(AnalyzerStatistics analyzerStatistics)
 {
     return(ResultPresenterControl.CreateForLoadBatch(analyzerStatistics));
 }
 public static ResultPresenterControl CreateForLoadBatch(AnalyzerStatistics analyzerStatistics)
 {
     return(new ResultPresenterControl(analyzerStatistics, liveMode: false, batchMode: false, loadBatchMode: true));
 }