private string ToTextString()
        {
            StringBuilder          stringBuilder          = new StringBuilder();
            QueryMetricsTextWriter queryMetricsTextWriter = new QueryMetricsTextWriter(stringBuilder);

            queryMetricsTextWriter.WriteQueryMetrics(this);
            return(stringBuilder.ToString());
        }
Пример #2
0
        protected override void WriteBeforeSchedulingMetrics()
        {
            QueryMetricsTextWriter.AppendNewlineToStringBuilder(stringBuilder);

            // Building the table for scheduling metrics
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.SchedulingMetrics, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.TopLine, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.Header, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.MiddleLine, indentLevel: 1);
        }
Пример #3
0
        protected override void WriteBeforePartitionExecutionTimeline()
        {
            QueryMetricsTextWriter.AppendNewlineToStringBuilder(stringBuilder);

            // Building the table for fetch execution ranges
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.FetchExecutionRanges, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.TopLine, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.Header, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.MiddleLine, indentLevel: 1);
        }
Пример #4
0
        private static void AppendRUToStringBuilder(StringBuilder stringBuilder, string property, double requestCharge, int indentLevel)
        {
            const string RequestChargeFormatString = "{0:n2}";
            const string RequestChargeUnitString   = "RUs";

            QueryMetricsTextWriter.AppendToStringBuilder(
                stringBuilder,
                property,
                string.Format(CultureInfo.InvariantCulture, RequestChargeFormatString, requestCharge),
                RequestChargeUnitString,
                indentLevel);
        }
Пример #5
0
        private static void AppendBytesToStringBuilder(StringBuilder stringBuilder, string property, long bytes, int indentLevel)
        {
            const string BytesFormatString = "{0:n0}";
            const string BytesUnitString   = "bytes";

            QueryMetricsTextWriter.AppendToStringBuilder(
                stringBuilder,
                property,
                string.Format(CultureInfo.InvariantCulture, BytesFormatString, bytes),
                BytesUnitString,
                indentLevel);
        }
Пример #6
0
        private static void AppendPercentageToStringBuilder(StringBuilder stringBuilder, string property, double percentage, int indentLevel)
        {
            const string PercentageFormatString = "{0:n2}";
            const string PercentageUnitString   = "%";

            QueryMetricsTextWriter.AppendToStringBuilder(
                stringBuilder,
                property,
                string.Format(CultureInfo.InvariantCulture, PercentageFormatString, percentage * 100),
                PercentageUnitString,
                indentLevel);
        }
Пример #7
0
        private static void AppendTimeSpanToStringBuilder(StringBuilder stringBuilder, string property, TimeSpan timeSpan, int indentLevel)
        {
            const string MillisecondsFormatString = "{0:n2}";
            const string MillisecondsUnitString   = "milliseconds";

            QueryMetricsTextWriter.AppendToStringBuilder(
                stringBuilder,
                property,
                string.Format(CultureInfo.InvariantCulture, MillisecondsFormatString, timeSpan.TotalMilliseconds),
                MillisecondsUnitString,
                indentLevel);
        }
Пример #8
0
        private static void AppendCountToStringBuilder(StringBuilder stringBuilder, string property, long count, int indentLevel)
        {
            const string CountFormatString = "{0:n0}";
            const string CountUnitString   = "";

            QueryMetricsTextWriter.AppendToStringBuilder(
                stringBuilder,
                property,
                string.Format(CultureInfo.InvariantCulture, CountFormatString, count),
                CountUnitString,
                indentLevel);
        }
Пример #9
0
 protected override void WriteAfterPartitionSchedulingTimeSpan()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(
         stringBuilder,
         SchedulingMetricsTable.GetRow(
             this.lastSchedulingPartitionId,
             this.lastResponseTime.TotalMilliseconds.ToString("0.00"),
             this.lastRunTime.TotalMilliseconds.ToString("0.00"),
             this.lastWaitTime.TotalMilliseconds.ToString("0.00"),
             this.lastTurnaroundTime.TotalMilliseconds.ToString("0.00"),
             this.lastNumberOfPreemptions),
         indentLevel: 1);
 }
Пример #10
0
 protected override void WriteAfterFetchExecutionRange()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(
         stringBuilder,
         PartitionExecutionTimelineTable.GetRow(
             this.lastFetchPartitionId,
             this.lastActivityId,
             this.lastStartTime.ToUniversalTime().ToString(DateTimeFormat),
             this.lastEndTime.ToUniversalTime().ToString(DateTimeFormat),
             (this.lastEndTime - this.lastStartTime).TotalMilliseconds.ToString("0.00"),
             this.lastFetchDocumentCount,
             this.lastFetchRetryCount),
         indentLevel: 1);
 }
Пример #11
0
 protected override void WriteIndexHitRatio(double indexHitRatio)
 {
     QueryMetricsTextWriter.AppendPercentageToStringBuilder(stringBuilder, QueryMetricsTextWriter.IndexUtilization, indexHitRatio, indentLevel: 0);
 }
Пример #12
0
 protected override void WriteAfterPartitionExecutionTimeline()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.BottomLine, indentLevel: 1);
 }
Пример #13
0
 protected override void WriteTotalQueryExecutionTime(TimeSpan totalQueryExecutionTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.TotalQueryExecutionTime, totalQueryExecutionTime, indentLevel: 0);
 }
Пример #14
0
 protected override void WriteLogicalPlanBuildTime(TimeSpan logicalPlanBuildTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.LogicalPlanBuildTime, logicalPlanBuildTime, 2);
 }
Пример #15
0
 protected override void WriteQueryOptimizationTime(TimeSpan queryOptimizationTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.QueryOptimizationTime, queryOptimizationTime, 2);
 }
Пример #16
0
 protected override void WriteDocumentWriteTime(TimeSpan documentWriteTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.DocumentWriteTime, documentWriteTime, indentLevel: 1);
 }
Пример #17
0
 protected override void WriteUserDefinedFunctionExecutionTime(TimeSpan userDefinedFunctionExecutionTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.UserDefinedFunctionExecutionTime, userDefinedFunctionExecutionTime, 2);
 }
Пример #18
0
 protected override void WriteSystemFunctionExecutionTime(TimeSpan systemFunctionExecutionTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.SystemFunctionExecuteTime, systemFunctionExecutionTime, 2);
 }
Пример #19
0
 protected override void WriteQueryEngineExecutionTime(TimeSpan queryEngineExecutionTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.QueryEngineTimes, queryEngineExecutionTime, 2);
 }
Пример #20
0
 protected override void WriteBeforeRuntimeExecutionTimes()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.RuntimeExecutionTimes, indentLevel: 1);
 }
Пример #21
0
 protected override void WriteIndexLookupTime(TimeSpan indexLookupTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.IndexLookupTime, indexLookupTime, indentLevel: 1);
 }
Пример #22
0
 protected override void WriteAfterSchedulingMetrics()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.BottomLine, indentLevel: 1);
 }
Пример #23
0
 private static void AppendNewlineToStringBuilder(StringBuilder stringBuilder)
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, string.Empty, 0);
 }
Пример #24
0
 protected override void WritePhysicalPlanBuildTime(TimeSpan physicalPlanBuildTime)
 {
     QueryMetricsTextWriter.AppendTimeSpanToStringBuilder(stringBuilder, QueryMetricsTextWriter.PhysicalPlanBuildTime, physicalPlanBuildTime, 2);
 }
Пример #25
0
 protected override void WriteOutputDocumentSize(long outputDocumentSize)
 {
     QueryMetricsTextWriter.AppendBytesToStringBuilder(stringBuilder, QueryMetricsTextWriter.OutputDocumentSize, outputDocumentSize, indentLevel: 0);
 }
Пример #26
0
 protected override void WriteRequestCharge(double requestCharge)
 {
     QueryMetricsTextWriter.AppendRUToStringBuilder(stringBuilder, QueryMetricsTextWriter.RequestCharge, requestCharge, indentLevel: 1);
 }
Пример #27
0
 protected override void WriteBeforeClientSideMetrics()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.ClientSideQueryMetrics, indentLevel: 0);
 }
Пример #28
0
 protected override void WriteBeforeQueryPreparationTimes()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.QueryPreparationTimes, indentLevel: 1);
 }
Пример #29
0
 protected override void WriteRetries(long retries)
 {
     QueryMetricsTextWriter.AppendCountToStringBuilder(stringBuilder, QueryMetricsTextWriter.Retries, retries, indentLevel: 1);
 }
Пример #30
0
 protected override void WriteOutputDocumentCount(long outputDocumentCount)
 {
     QueryMetricsTextWriter.AppendCountToStringBuilder(stringBuilder, QueryMetricsTextWriter.OutputDocumentCount, outputDocumentCount, indentLevel: 0);
 }