public TraceStorageEngineEvent(DaxStudioTraceEventArgs ev, int rowNumber) { RowNumber = rowNumber; Class = ev.EventClass; Subclass = ev.EventSubclass; if (Class == DaxStudioTraceEventClass.DirectQueryEnd) { Query = ev.TextData; } else { // TODO: we should implement as optional the removal of aliases and lineage Query = ev.TextData.RemoveDaxGuids().RemoveXmSqlSquareBrackets().RemoveAlias().RemoveLineage().FixEmptyArguments().RemoveRowNumberGuid(); } // Set flag in case any highlight is present HighlightQuery = QueryRichText.Contains("|~E~|"); // Skip Duration/Cpu Time for Cache Match if (ClassSubclass.Subclass != DaxStudioTraceEventSubclass.VertiPaqCacheExactMatch) { Duration = ev.Duration; CpuTime = ev.CpuTime; } long rows, bytes; if (Query.ExtractEstimatedSize(out rows, out bytes)) { EstimatedRows = rows; EstimatedKBytes = 1 + bytes / 1024; } }
public TraceStorageEngineEvent(DaxStudioTraceEventArgs ev, int rowNumber) { RowNumber = rowNumber; Class = ev.EventClass; Subclass = ev.EventSubclass; switch (Class) { //case DaxStudioTraceEventClass.DirectQueryEnd: // Query = ev.TextData; // break; case DaxStudioTraceEventClass.AggregateTableRewriteQuery: // the rewrite event does not have a query or storage engine timings break; case DaxStudioTraceEventClass.DirectQueryBegin: case DaxStudioTraceEventClass.DirectQueryEnd: // Don't process DirectQuery text Query = ev.TextData; QueryRichText = Query; break; default: // TODO: we should implement as optional the removal of aliases and lineage Query = ev.TextData.RemoveDaxGuids().RemoveXmSqlSquareBrackets().RemoveAlias().RemoveLineage().FixEmptyArguments().RemoveRowNumberGuid(); QueryRichText = Query; // Set flag in case any highlight is present HighlightQuery = QueryRichText.Contains("|~E~|"); break; } // Skip Duration/Cpu Time for Cache Match if (ClassSubclass.Subclass != DaxStudioTraceEventSubclass.VertiPaqCacheExactMatch) { Duration = ev.Duration; if (ClassSubclass.Subclass != DaxStudioTraceEventSubclass.RewriteAttempted) { CpuTime = ev.CpuTime; } } if (Query != null && Query?.Length > 0) { long rows, bytes; if (Query.ExtractEstimatedSize(out rows, out bytes)) { EstimatedRows = rows; EstimatedKBytes = 1 + bytes / 1024; } } }