public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var messages = tableData.QueryOutput <IReadOnlyList <IDiagnosticMessage> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngDmesgDataCooker.Identifier, nameof(LTTngDmesgDataCooker.DiagnosticMessages))); if (messages.Count == 0) { return; } var config = new TableConfiguration("MessagesByTimestamp") { Columns = new[] { messageColumn, TableConfiguration.PivotColumn, TableConfiguration.GraphColumn, timestampColumn }, }; config.AddColumnRole(ColumnRole.StartTime, timestampColumn); config.AddColumnRole(ColumnRole.EndTime, timestampColumn); var table = tableBuilder.AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(messages.Count); table.AddColumn(messageColumn, Projection.CreateUsingFuncAdaptor((i) => messages[i].Message)); table.AddColumn(timestampColumn, Projection.CreateUsingFuncAdaptor((i) => messages[i].Timestamp)); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { WaLinuxAgentLogParsedResult parsedResult = tableData.QueryOutput <WaLinuxAgentLogParsedResult>( DataOutputPath.ForSource(SourceParserIds.WaLinuxAgentLog, WaLinuxAgentDataCooker.CookerId, nameof(WaLinuxAgentDataCooker.ParsedResult))); var logEntries = parsedResult.LogEntries; var baseProjection = Projection.Index(logEntries); var fileNameProjection = baseProjection.Compose(x => x.FilePath); var lineNumberProjection = baseProjection.Compose(x => x.LineNumber); var eventTimeProjection = baseProjection.Compose(x => x.EventTimestamp); var logLevelProjection = baseProjection.Compose(x => x.LogLevel); var logProjection = baseProjection.Compose(x => x.Log); // // Table Configurations describe how your table should be presented to the user: // the columns to show, what order to show them, which columns to aggregate, and which columns to graph. // You may provide a number of columns in your table, but only want to show a subset of them by default so as not to overwhelm the user. // The user can still open the table properties in UI to turn on or off columns. // The table configuration class also exposes four (4) columns that UI explicitly recognizes: Pivot Column, Graph Column, Left Freeze Column, Right Freeze Column // For more information about what these columns do, go to "Advanced Topics" -> "Table Configuration" in our Wiki. Link can be found in README.md // var config = new TableConfiguration("Default") { Columns = new[] { LogLevelColumn, TableConfiguration.PivotColumn, LineNumberColumn, LogColumn, EventTimestampDateTimeColumn, TableConfiguration.GraphColumn, EventTimestampColumn, }, }; config.AddColumnRole(ColumnRole.StartTime, EventTimestampColumn); // // // Use the table builder to build the table. // Add and set table configuration if applicable. // Then set the row count (we have one row per file) and then add the columns using AddColumn. // tableBuilder .AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(logEntries.Count) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(LineNumberColumn, lineNumberProjection) .AddColumn(EventTimestampColumn, eventTimeProjection) .AddColumn(LogLevelColumn, logLevelProjection) .AddColumn(LogColumn, logProjection); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var threads = tableData.QueryOutput <IReadOnlyList <IThread> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngThreadDataCooker.Identifier, nameof(LTTngThreadDataCooker.Threads))); if (threads.Count == 0) { return; } var config = new TableConfiguration("ThreadsByProcessId") { Columns = new[] { processIdColumn, threadIdColumn, commandColumn, TableConfiguration.PivotColumn, threadExecTimeColumn, threadReadyTimeColumn, threadRunningTimeColumn, threadSleepTimeColumn, threadDiskSleepTimeColumn, threadWaitingTimeColumn, threadIdleTimeColumn, TableConfiguration.GraphColumn, threadStartTimeColumn, threadExitTimeColumn }, }; config.AddColumnRole(ColumnRole.StartTime, threadStartTimeColumn); config.AddColumnRole(ColumnRole.EndTime, threadExitTimeColumn); var table = tableBuilder.AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(threads.Count); table.AddColumn(threadIdColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ThreadId)); table.AddColumn(processIdColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ProcessId)); table.AddColumn(commandColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].Command)); table.AddColumn(threadExecTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ExecTime)); table.AddColumn(threadReadyTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ReadyTime)); table.AddColumn(threadRunningTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ExecTime + threads[i].ReadyTime)); table.AddColumn(threadSleepTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].SleepTime)); table.AddColumn(threadDiskSleepTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].DiskSleepTime)); table.AddColumn(threadWaitingTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].SleepTime + threads[i].DiskSleepTime)); table.AddColumn(threadStoppedTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].StoppedTime)); table.AddColumn(threadParkedTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ParkedTime)); table.AddColumn(threadIdleTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].IdleTime)); table.AddColumn(threadStartTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].StartTime)); table.AddColumn(threadExitTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ExitTime)); table.AddColumn(threadLifespanColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ExitTime - threads[i].StartTime)); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { CloudInitLogParsedResult parsedResult = tableData.QueryOutput <CloudInitLogParsedResult>( DataOutputPath.ForSource(SourceParserIds.CloudInitLog, CloudInitDataCooker.CookerId, nameof(CloudInitDataCooker.ParsedResult))); var logEntries = parsedResult.LogEntries; var baseProjection = Projection.Index(logEntries); var fileNameProjection = baseProjection.Compose(x => x.FilePath); var lineNumberProjection = baseProjection.Compose(x => x.LineNumber); var eventTimeProjection = baseProjection.Compose(x => x.EventTimestamp); var pythonFileProjection = baseProjection.Compose(x => x.PythonFile); var logLevelProjection = baseProjection.Compose(x => x.LogLevel); var logProjection = baseProjection.Compose(x => x.Log); var config = new TableConfiguration("Default") { Columns = new[] { FileNameColumn, LogLevelColumn, TableConfiguration.PivotColumn, PythonFileColumn, LineNumberColumn, LogColumn, EventTimestampDateTimeColumn, TableConfiguration.GraphColumn, EventTimestampColumn, }, }; config.AddColumnRole(ColumnRole.StartTime, EventTimestampColumn); // // // Use the table builder to build the table. // Add and set table configuration if applicable. // Then set the row count (we have one row per file) and then add the columns using AddColumn. // tableBuilder .AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(logEntries.Count) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(LineNumberColumn, lineNumberProjection) .AddColumn(EventTimestampColumn, eventTimeProjection) .AddColumn(PythonFileColumn, pythonFileProjection) .AddColumn(LogLevelColumn, logLevelProjection) .AddColumn(LogColumn, logProjection) ; }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var parsedResult = tableData.QueryOutput <AndroidLogcatParsedResult>( DataOutputPath.ForSource(SourceParserIds.AndroidLogcatLog, AndroidLogcatDataCooker.CookerId, nameof(AndroidLogcatDataCooker.ParsedResult))); var logEntries = parsedResult.LogEntries; var baseProjection = Projection.Index(logEntries); var timestampProjection = baseProjection.Compose(x => x.Timestamp); var fileNameProjection = baseProjection.Compose(x => x.FilePath); var lineNumberProjection = baseProjection.Compose(x => x.LineNumber); var pidProjection = baseProjection.Compose(x => x.PID); var tidProjection = baseProjection.Compose(x => x.TID); var priorityProjection = baseProjection.Compose(x => x.Priority); var tagProjection = baseProjection.Compose(x => x.Tag); var messageProjection = baseProjection.Compose(x => x.Message); var config = new TableConfiguration("Default") { Columns = new[] { FileNameColumn, TableConfiguration.PivotColumn, LineNumberColumn, TimestampAbsColumn, PIDColumn, TIDColumn, PriorityColumn, TagColumn, MessageColumn, TableConfiguration.RightFreezeColumn, TableConfiguration.GraphColumn, TimestampColumn }, }; config.AddColumnRole(ColumnRole.StartTime, TimestampColumn); tableBuilder.AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(logEntries.Count) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(LineNumberColumn, lineNumberProjection) .AddColumn(PIDColumn, pidProjection) .AddColumn(TIDColumn, pidProjection) .AddColumn(PriorityColumn, priorityProjection) .AddColumn(MessageColumn, messageProjection) .AddColumn(TimestampColumn, timestampProjection) .AddColumn(TagColumn, tagProjection); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { CloudInitLogParsedResult parsedResult = tableData.QueryOutput <CloudInitLogParsedResult>( DataOutputPath.ForSource(SourceParserIds.CloudInitLog, CloudInitDataCooker.CookerId, nameof(CloudInitDataCooker.ParsedResult))); var fileNames = parsedResult.FileToMetadata.Keys.ToArray(); var fileNameProjection = Projection.Index(fileNames.AsReadOnly()); var lineCountProjection = fileNameProjection.Compose( fileName => parsedResult.FileToMetadata[fileName].LineCount); tableBuilder.SetRowCount(fileNames.Length) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(LineCountColumn, lineCountProjection); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var syscalls = tableData.QueryOutput <IReadOnlyList <ISyscall> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngSyscallDataCooker.Identifier, nameof(LTTngSyscallDataCooker.Syscalls))); if (syscalls.Count == 0) { return; } var defaultConfig = new TableConfiguration("Individual Syscalls") { Columns = new[] { syscallNumberColumn, TableConfiguration.PivotColumn, syscallNameColumn, syscallDurationColumn, syscallArgumentsColumn, syscallReturnValueColumn, syscallThreadIdColumn, syscallCommandColumn, syscallProcessIdColumn, TableConfiguration.GraphColumn, syscallStartTimeColumn, syscallEndTimeColumn }, }; defaultConfig.AddColumnRole(ColumnRole.StartTime, syscallStartTimeColumn); defaultConfig.AddColumnRole(ColumnRole.EndTime, syscallEndTimeColumn); var table = tableBuilder.AddTableConfiguration(defaultConfig) .SetDefaultTableConfiguration(defaultConfig) .SetRowCount(syscalls.Count); table.AddColumn(syscallNameColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].Name)); table.AddColumn(syscallThreadIdColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].ThreadId)); table.AddColumn(syscallProcessIdColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].ProcessId)); table.AddColumn(syscallCommandColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].ProcessCommand)); table.AddColumn(syscallNumberColumn, Projection.CreateUsingFuncAdaptor((i) => i + 1)); table.AddColumn(syscallStartTimeColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].StartTime)); table.AddColumn(syscallEndTimeColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].EndTime)); table.AddColumn(syscallDurationColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].EndTime - syscalls[i].StartTime)); table.AddColumn(syscallReturnValueColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].ReturnValue)); table.AddColumn(syscallArgumentsColumn, Projection.CreateUsingFuncAdaptor((i) => syscalls[i].Arguments)); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { DmesgIsoLogParsedResult parsedResult = tableData.QueryOutput <DmesgIsoLogParsedResult>( DataOutputPath.ForSource(SourceParserIds.DmesgIsoLog, DmesgIsoDataCooker.CookerId, nameof(DmesgIsoDataCooker.ParsedResult))); var logEntries = parsedResult.LogEntries; var baseProjection = Projection.Index(logEntries); var fileNameProjection = baseProjection.Compose(x => x.filePath); var lineNumberProjection = baseProjection.Compose(x => x.lineNumber); var entityProjection = baseProjection.Compose(x => x.entity); var topicProjection = baseProjection.Compose(x => x.topic); var timestampProjection = baseProjection.Compose(x => x.timestamp); var metadataProjection = baseProjection.Compose(x => x.metadata); var messageProjection = baseProjection.Compose(x => x.message); var config = new TableConfiguration("Default") { Columns = new[] { FileNameColumn, EntityColumn, TableConfiguration.PivotColumn, MessageNumberColumn, TopicColumn, MessageColumn, MetadataColumn, TableConfiguration.GraphColumn, TimestampColumn }, }; config.AddColumnRole(ColumnRole.StartTime, TimestampColumn); config.AddColumnRole(ColumnRole.EndTime, TimestampColumn); tableBuilder.AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(logEntries.Count) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(MessageNumberColumn, lineNumberProjection) .AddColumn(EntityColumn, entityProjection) .AddColumn(TopicColumn, topicProjection) .AddColumn(MessageColumn, messageProjection) .AddColumn(TimestampColumn, timestampProjection) .AddColumn(MetadataColumn, metadataProjection); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var fileEvents = tableData.QueryOutput <IReadOnlyList <IFileEvent> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngDiskDataCooker.Identifier, nameof(LTTngDiskDataCooker.FileEvents))); if (fileEvents.Count == 0) { return; } var config = new TableConfiguration("EventsBySyscallType") { Columns = new[] { fileEventNameColumn, TableConfiguration.PivotColumn, fileEventThreadIdColumn, fileEventProcessIdColumn, fileEventCommandColumn, fileEventFilePathColumn, fileEventSizeColumn, fileEventDurationColumn, TableConfiguration.GraphColumn, fileEventStartTimeColumn, fileEventEndTimeColumn }, }; config.AddColumnRole(ColumnRole.StartTime, fileEventStartTimeColumn); config.AddColumnRole(ColumnRole.EndTime, fileEventEndTimeColumn); var table = tableBuilder.AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(fileEvents.Count); table.AddColumn(fileEventNameColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].Name)); table.AddColumn(fileEventThreadIdColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].ThreadId)); table.AddColumn(fileEventProcessIdColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].ProcessId)); table.AddColumn(fileEventCommandColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].ProcessCommand)); table.AddColumn(fileEventFilePathColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].Filepath)); table.AddColumn(fileEventStartTimeColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].StartTime)); table.AddColumn(fileEventEndTimeColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].EndTime)); table.AddColumn(fileEventDurationColumn, Projection.CreateUsingFuncAdaptor((i) => fileEvents[i].EndTime - fileEvents[i].StartTime)); table.AddColumn(fileEventSizeColumn, new FileActivitySizeProjection(Projection.CreateUsingFuncAdaptor((i) => fileEvents[i]))); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var moduleEvents = tableData.QueryOutput <IReadOnlyList <IModuleEvent> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngModuleDataCooker.Identifier, nameof(LTTngModuleDataCooker.ModuleEvents))); if (moduleEvents.Count == 0) { return; } var defaultConfig = new TableConfiguration("Module Events") { Columns = new[] { moduleNameColumn, eventTypeColumn, TableConfiguration.PivotColumn, instructionPointerColumn, refCountColumn, threadIdColumn, processIdColumn, commandColumn, TableConfiguration.GraphColumn, timestampColumn }, }; defaultConfig.AddColumnRole(ColumnRole.StartTime, timestampColumn); defaultConfig.AddColumnRole(ColumnRole.EndTime, timestampColumn); var table = tableBuilder.AddTableConfiguration(defaultConfig) .SetDefaultTableConfiguration(defaultConfig) .SetRowCount(moduleEvents.Count); table.AddColumn(eventTypeColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].EventType)); table.AddColumn(moduleNameColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].ModuleName)); table.AddColumn(instructionPointerColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].InstructionPointer)); table.AddColumn(refCountColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].RefCount)); table.AddColumn(threadIdColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].ThreadId)); table.AddColumn(processIdColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].ProcessId)); table.AddColumn(commandColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].ProcessCommand)); table.AddColumn(timestampColumn, Projection.CreateUsingFuncAdaptor((i) => moduleEvents[i].Time)); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var parsedResult = tableData.QueryOutput <AndroidLogcatParsedResult>( DataOutputPath.ForSource(SourceParserIds.AndroidLogcatLog, AndroidLogcatDataCooker.CookerId, nameof(AndroidLogcatDataCooker.ParsedResult))); var durationEntries = parsedResult.DurationLogEntries; var baseProjection = Projection.Index(durationEntries); var nameProjection = baseProjection.Compose(x => x.Name); var startTimestampProjection = baseProjection.Compose(x => x.StartTimestamp); var endTimestampProjection = baseProjection.Compose(x => x.EndTimestamp); var durationProjection = baseProjection.Compose(x => x.Duration); var fileNameProjection = baseProjection.Compose(x => x.FilePath); var lineNumberProjection = baseProjection.Compose(x => x.LineNumber); var pidProjection = baseProjection.Compose(x => x.PID); var tidProjection = baseProjection.Compose(x => x.TID); var priorityProjection = baseProjection.Compose(x => x.Priority); var tagProjection = baseProjection.Compose(x => x.Tag); var messageProjection = baseProjection.Compose(x => x.Message); var timeOrderConfig = new TableConfiguration("Time Order") { Columns = new[] { FileNameColumn, LineNumberColumn, NameColumn, TableConfiguration.PivotColumn, PIDColumn, TIDColumn, PriorityColumn, TagColumn, MessageColumn, DurationColumn, TableConfiguration.GraphColumn, StartTimestampColumnSorted, EndTimestampColumn }, }; timeOrderConfig.AddColumnRole(ColumnRole.StartTime, StartTimestampColumnSorted); timeOrderConfig.AddColumnRole(ColumnRole.EndTime, EndTimestampColumn); timeOrderConfig.AddColumnRole(ColumnRole.Duration, DurationColumn); var longestDurationConfig = new TableConfiguration("Longest Duration") { Columns = new[] { FileNameColumn, TagColumn, NameColumn, TableConfiguration.PivotColumn, LineNumberColumn, PIDColumn, TIDColumn, PriorityColumn, MessageColumn, DurationColumnOrderedMax, TableConfiguration.GraphColumn, StartTimestampColumn, EndTimestampColumn }, }; longestDurationConfig.AddColumnRole(ColumnRole.StartTime, StartTimestampColumnSorted); longestDurationConfig.AddColumnRole(ColumnRole.EndTime, EndTimestampColumn); longestDurationConfig.AddColumnRole(ColumnRole.Duration, DurationColumnOrderedMax); tableBuilder .AddTableConfiguration(timeOrderConfig) .AddTableConfiguration(longestDurationConfig) .SetDefaultTableConfiguration(longestDurationConfig) .SetRowCount(durationEntries.Count) .AddColumn(NameColumn, nameProjection) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(LineNumberColumn, lineNumberProjection) .AddColumn(PIDColumn, pidProjection) .AddColumn(TIDColumn, pidProjection) .AddColumn(PriorityColumn, priorityProjection) .AddColumn(MessageColumn, messageProjection) .AddColumn(DurationColumn, durationProjection) .AddColumn(StartTimestampColumnSorted, startTimestampProjection) .AddColumn(EndTimestampColumn, endTimestampProjection) .AddColumn(TagColumn, tagProjection); }
public static bool IsDataAvailable(IDataExtensionRetrieval tableData) { return(tableData.QueryOutput <IReadOnlyList <IFileEvent> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngDiskDataCooker.Identifier, nameof(LTTngDiskDataCooker.FileEvents))).Any()); }
public static bool IsDataAvailable(IDataExtensionRetrieval tableData) { return(tableData.QueryOutput <IReadOnlyList <IDiagnosticMessage> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngDmesgDataCooker.Identifier, nameof(LTTngDmesgDataCooker.DiagnosticMessages))).Any()); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var threads = tableData.QueryOutput <IReadOnlyList <IExecutionEvent> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngThreadDataCooker.Identifier, nameof(LTTngThreadDataCooker.ExecutionEvents))); if (threads.Count == 0) { return; } const string filterIdleSamplesQuery = "[New Thread Id]:=\"0\""; var timelineByCPUTableConfig = new TableConfiguration("Timeline by CPU") { Columns = new[] { cpuColumn, nextPidColumn, nextTidColumn, TableConfiguration.PivotColumn, nextCommandColumn, previousStateColumn, nextThreadPreviousSwitchOutTimeColumn, previousTidColumn, readyingPidColumn, readyingTidColumn, readyTimeColumn, waitTimeColumn, switchedInTimeColumn, priorityColumn, TableConfiguration.GraphColumn, switchInTimeColumn, switchOutTimeColumn }, InitialFilterShouldKeep = false, InitialFilterQuery = filterIdleSamplesQuery, }; timelineByCPUTableConfig.AddColumnRole(ColumnRole.StartTime, switchInTimeColumn); timelineByCPUTableConfig.AddColumnRole(ColumnRole.ResourceId, cpuColumn); timelineByCPUTableConfig.AddColumnRole(ColumnRole.Duration, switchedInTimeColumn); var utilByProcessCmdTable = new TableConfiguration("Utilization by Process Id, Thread Id, Cmd") { Columns = new[] { nextPidColumn, nextTidColumn, nextCommandColumn, TableConfiguration.PivotColumn, cpuColumn, previousStateColumn, nextThreadPreviousSwitchOutTimeColumn, previousTidColumn, readyingPidColumn, readyingTidColumn, switchInTimeColumn, readyTimeColumn, waitTimeColumn, switchedInTimeColumn, priorityColumn, TableConfiguration.GraphColumn, percentCpuUsagePreset, }, InitialFilterShouldKeep = false, InitialFilterQuery = filterIdleSamplesQuery, }; utilByProcessCmdTable.AddColumnRole(ColumnRole.StartTime, switchInTimeColumn); utilByProcessCmdTable.AddColumnRole(ColumnRole.ResourceId, cpuColumn); utilByProcessCmdTable.AddColumnRole(ColumnRole.Duration, switchedInTimeColumn); var utilByCpuTable = new TableConfiguration("Utilization by CPU") { Columns = new[] { cpuColumn, TableConfiguration.PivotColumn, nextPidColumn, nextTidColumn, nextCommandColumn, previousStateColumn, nextThreadPreviousSwitchOutTimeColumn, previousTidColumn, readyingPidColumn, readyingTidColumn, switchInTimeColumn, readyTimeColumn, waitTimeColumn, switchedInTimeColumn, priorityColumn, TableConfiguration.GraphColumn, percentCpuUsagePreset, }, InitialFilterShouldKeep = false, InitialFilterQuery = filterIdleSamplesQuery, }; utilByCpuTable.AddColumnRole(ColumnRole.StartTime, switchInTimeColumn); utilByCpuTable.AddColumnRole(ColumnRole.ResourceId, cpuColumn); utilByCpuTable.AddColumnRole(ColumnRole.Duration, switchedInTimeColumn); var table = tableBuilder.AddTableConfiguration(timelineByCPUTableConfig) .AddTableConfiguration(utilByProcessCmdTable) .AddTableConfiguration(utilByCpuTable) .SetDefaultTableConfiguration(utilByProcessCmdTable) .SetRowCount(threads.Count); var switchInTime = Projection.CreateUsingFuncAdaptor((i) => threads[i].SwitchInTime); var switchOutTime = Projection.CreateUsingFuncAdaptor((i) => threads[i].SwitchOutTime); table.AddColumn(cpuColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].Cpu)); table.AddColumn(nextPidColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].NextPid)); table.AddColumn(nextTidColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].NextTid)); table.AddColumn(previousStateColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].PreviousState)); table.AddColumn(nextThreadPreviousSwitchOutTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].NextThreadPreviousSwitchOutTime)); table.AddColumn(previousTidColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].PreviousTid)); table.AddColumn(readyingPidColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ReadyingPid)); table.AddColumn(readyingTidColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ReadyingTid)); table.AddColumn(readyTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].ReadyTime)); table.AddColumn(waitTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].WaitTime)); table.AddColumn(switchedInTimeColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].SwitchOutTime - threads[i].SwitchInTime)); table.AddColumn(priorityColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].Priority)); table.AddColumn(switchInTimeColumn, switchInTime); table.AddColumn(switchOutTimeColumn, switchOutTime); table.AddColumn(previousPidColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].PreviousPid)); table.AddColumn(nextCommandColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].NextImage)); table.AddColumn(previousCommandColumn, Projection.CreateUsingFuncAdaptor((i) => threads[i].PreviousImage)); // Time the thread switching in switches out var viewportClippedSwitchOutTimeForNextOnCpuColumn = Projection.ClipTimeToVisibleDomain.Create(switchOutTime); // Switch in time is the thread switching in, which is the switch out time of the thread switching out on the CPU var viewportClippedSwitchOutTimeForPreviousOnCpuColumn = Projection.ClipTimeToVisibleDomain.Create(switchInTime); IProjection <int, TimestampDelta> cpuUsageInViewportColumn = Projection.Select( viewportClippedSwitchOutTimeForNextOnCpuColumn, viewportClippedSwitchOutTimeForPreviousOnCpuColumn, new ReduceTimeSinceLastDiff()); var percentCpuUsageColumn = Projection.VisibleDomainRelativePercent.Create(cpuUsageInViewportColumn); var cpuUsageColumn = Projection.Select(switchOutTime, switchInTime, new ReduceTimeSinceLastDiff()); table.AddColumn(cpuUsageInViewportPreset, cpuUsageInViewportColumn); table.AddColumn(cpuUsagePreset, cpuUsageColumn); table.AddColumn(percentCpuUsagePreset, percentCpuUsageColumn); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { int maximumFieldCount = tableData.QueryOutput <int>( DataOutputPath.ForSource(PerfConstants.SourceId, PerfGenericEventDataCooker.Identifier, nameof(PerfGenericEventDataCooker.MaximumEventFieldCount))); var events = tableData.QueryOutput <ProcessedEventData <PerfGenericEvent> >( DataOutputPath.ForSource(PerfConstants.SourceId, PerfGenericEventDataCooker.Identifier, nameof(PerfGenericEventDataCooker.Events))); var tableGenerator = tableBuilder.SetRowCount((int)events.Count); var genericEventProjection = new EventProjection <PerfGenericEvent>(events); var eventNameColumn = new DataColumn <string>( eventNameColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.EventName)); tableGenerator.AddColumn(eventNameColumn); var eventIdColumn = new DataColumn <uint>( eventIdColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.Id)); tableGenerator.AddColumn(eventIdColumn); var cpuIdColumn = new DataColumn <uint>( cpuIdColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.CpuId)); tableGenerator.AddColumn(cpuIdColumn); var eventTimestampColumn = new DataColumn <Timestamp>( eventTimestampColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.Timestamp)); tableGenerator.AddColumn(eventTimestampColumn); tableGenerator.AddColumn(countColumnConfig, Projection.Constant(1)); // Add the field columns, with column names depending on the given event for (int columnIndex = 0; columnIndex < maximumFieldCount; columnIndex++) { string fieldName = "Field " + (columnIndex + 1); var genericEventFieldProjection = new GenericEventFieldProjection(columnIndex, genericEventProjection); var genericEventFieldNameProjection = genericEventFieldProjection.Compose((field) => field.HasValue ? field.Value.Name : string.Empty); // generate a column configuration var fieldColumnConfiguration = new ColumnConfiguration( new ColumnMetadata(Common.GenerateGuidFromName(fieldName), fieldName, genericEventFieldNameProjection, fieldName), new UIHints { IsVisible = true, Width = 80, TextAlignment = TextAlignment.Left, }); var genericEventFieldAsStringProjection = genericEventFieldProjection.Compose((field) => field.HasValue ? field.Value.Value : string.Empty); tableGenerator.AddColumn(fieldColumnConfiguration, genericEventFieldAsStringProjection); } }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var diskEvents = tableData.QueryOutput <IReadOnlyList <IDiskActivity> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngDiskDataCooker.Identifier, nameof(LTTngDiskDataCooker.DiskActivity))); if (diskEvents.Count == 0) { return; } var iosByDeviceThCmdConfig = new TableConfiguration("IOs by Device, ThreadId, Command") { Columns = new[] { deviceIdColumn, deviceNameColumn, threadIdColumn, commandColumn, TableConfiguration.PivotColumn, processIdColumn, filepathColumn, ioTimeSumColumn, sectorNumberColumn, diskOffsetColumn, sizeColumn, errorColumn, TableConfiguration.GraphColumn, insertTimeColumn, issueTimeColumn, completeTimeColumn }, }; var ioTimesByDevFileConfig = new TableConfiguration("IOTime by Device, FilePath") { Columns = new[] { deviceIdColumn, deviceNameColumn, TableConfiguration.PivotColumn, filepathColumn, threadIdColumn, processIdColumn, commandColumn, sectorNumberColumn, diskOffsetColumn, sizeColumn, errorColumn, insertTimeColumn, issueTimeColumn, completeTimeColumn, TableConfiguration.GraphColumn, ioTimeAvgColumn, ioTimeMaxColumn }, }; iosByDeviceThCmdConfig.AddColumnRole(ColumnRole.StartTime, insertTimeColumn); // config.AddColumnRole(ColumnRole.EndTime, completeTimeColumn); iosByDeviceThCmdConfig.AddColumnRole(ColumnRole.ResourceId, deviceIdColumn); // We have had past behavior where specifying this causes DevId 0 not to show? var table = tableBuilder.AddTableConfiguration(iosByDeviceThCmdConfig) .AddTableConfiguration(ioTimesByDevFileConfig) .SetDefaultTableConfiguration(iosByDeviceThCmdConfig) .SetRowCount((int)diskEvents.Count); var diskActivities = Projection.CreateUsingFuncAdaptor((i) => diskEvents[i]); var defaultTime = default(Timestamp); var ioStartTimeProjection = diskActivities.Compose(da => da.InsertTime ?? defaultTime); var ioEndTimeProjection = diskActivities.Compose(da => da.CompleteTime ?? defaultTime); var validIoTimeProjection = diskActivities.Compose(da => da.InsertTime.HasValue && da.CompleteTime.HasValue); table.AddColumn(deviceIdColumn, diskActivities.Compose(da => da.DeviceId)); table.AddColumn(deviceNameColumn, diskActivities.Compose(da => da.DeviceName)); table.AddColumn(filepathColumn, diskActivities.Compose(da => da.Filepath)); table.AddColumn(threadIdColumn, diskActivities.Compose(da => da.ThreadId)); table.AddColumn(processIdColumn, diskActivities.Compose(da => da.ProcessId)); table.AddColumn(commandColumn, diskActivities.Compose(da => da.ProcessCommand)); table.AddColumn(errorColumn, diskActivities.Compose(da => da.Error)); table.AddColumn(ioTimeIsValidColumnConfiguration, validIoTimeProjection); table.AddColumn(sectorNumberColumn, diskActivities.Compose(da => da.SectorNumber)); // todo:can we pick up the sector size from the trace? table.AddColumn(diskOffsetColumn, diskActivities.Compose(da => new Bytes(da.SectorNumber * 512))); table.AddColumn(insertTimeColumn, ioStartTimeProjection); table.AddColumn(issueTimeColumn, diskActivities.Compose(da => da.IssueTime ?? defaultTime)); table.AddColumn(completeTimeColumn, ioEndTimeProjection); var diskActivitiesProj = diskActivities.Compose((da) => { if (da.CompleteTime.HasValue) { if (da.InsertTime.HasValue) { return(da.CompleteTime.Value - da.InsertTime.Value); } } return(TimestampDelta.Zero); }); table.AddColumn(ioTimeAvgColumn, diskActivitiesProj); { IProjection <int, Timestamp> viewportClippedStartTimeColumn = Projection.ClipTimeToVisibleDomain.Create(ioStartTimeProjection); IProjection <int, Timestamp> viewportClippedEndTimeColumn = Projection.ClipTimeToVisibleDomain.Create(ioEndTimeProjection); // Timestamp delta for the given disk activity during the viewport time range. IProjection <int, TimestampDelta> clippedTimeDeltaColumn = Projection.Select( viewportClippedEndTimeColumn, viewportClippedStartTimeColumn, new ReduceTimeSinceLastDiff(validIoTimeProjection)); table.AddColumn(clippedTimestampDeltaColumnConfiguration, clippedTimeDeltaColumn); // Percent of time consumed by the timestamp delta in the current viewport. /* IProjection<int, double> ioTimeWeightPercentColumn = * Projection.ClipTimeToVisibleDomain.CreatePercent(clippedTimeDeltaColumn);*/ /// table.AddColumn(weightedIOTimeColumn, ioTimeWeightPercentColumn); } table.AddColumn(sizeColumn, new DiskActivitySizeProjection(diskActivities)); // IOCount with no restriction on IOSize - Used to enable some of the graphs in analyzer table.AddColumn(countColumn, Projection.Constant <int>(1)); // todo: should we move the Azure specific columns here? // IOCount when IOSize is 8KB (such as in Azure local SSD throttling) table.AddColumn(countColumn_IOSize8kb, diskActivities.Compose(da => da.Size.HasValue && da.Size.Value.Bytes > 0 ? Math.Ceiling((float)da.Size.Value.Bytes / (8 * 1024)) : 1)); // IOCount when IOSize is 256KB (such as in Azure XStore throttling) table.AddColumn(countColumn_IOSize256kb, diskActivities.Compose(da => da.Size.HasValue && da.Size.Value.Bytes > 0 ? Math.Ceiling((float)da.Size.Value.Bytes / (256 * 1024)) : 1)); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { var pathIdentifier = DataOutputPath.ForSource(PerfConstants.SourceId, PerfCpuClockDataCooker.Identifier, nameof(PerfCpuClockDataCooker.CpuClockEvents)); var cpuClocks = tableData.QueryOutput <IReadOnlyList <ICpuClockEvent> >(pathIdentifier); if (cpuClocks.Count == 0) { return; } var config = new TableConfiguration("CPU Utilization") { Columns = new[] { cpuColumn, callStackColumn, TableConfiguration.PivotColumn, pidColumn, threadIdColumn, ipColumn, symbolTypeColumn, ipSymbolColumn, idColumn, weightColumn, countColumn, timeStampColumn, TableConfiguration.GraphColumn, weightPctColumn }, }; config.AddColumnRole(ColumnRole.EndTime, timeStampColumn); config.AddColumnRole(ColumnRole.Duration, weightColumn); config.AddColumnRole(ColumnRole.ResourceId, cpuColumn); var table = tableBuilder.AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(cpuClocks.Count); var timeStampProjection = Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Timestamp); table.AddColumn(cpuColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Cpu)); table.AddColumn(ipColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Ip)); table.AddColumn(symbolTypeColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Ip_Symbol?.SymbolType?.SymbolTypeDescription.SymbolTypeShortName)); table.AddColumn(ipSymbolColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Ip_Symbol?.Name)); table.AddColumn(threadIdColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Tid)); table.AddColumn(pidColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Pid)); table.AddColumn(idColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Id)); table.AddColumn(perfPeriodColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Perf_Period)); table.AddColumn(perfCallchainSizeColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Perf_Callchain_Size)); table.AddHierarchicalColumn(callStackColumn, Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].CallStack), new ArrayAccessProvider <string>()); table.AddColumn(timeStampColumn, timeStampProjection); var oneMsSample = new TimestampDelta(1000000); // 1ms for now until we can figure out weight better var oneNs = new TimestampDelta(1); var weightProj = Projection.Constant(oneMsSample); var timeStampStartProjection = Projection.CreateUsingFuncAdaptor((i) => cpuClocks[i].Timestamp - oneNs); // We will say sample lasted 1ns IProjection <int, Timestamp> viewportClippedStartTimeProj = Projection.ClipTimeToVisibleDomain.Create(timeStampStartProjection); IProjection <int, Timestamp> viewportClippedEndTimeProj = Projection.ClipTimeToVisibleDomain.Create(timeStampProjection); IProjection <int, TimestampDelta> clippedWeightProj = Projection.Select( viewportClippedEndTimeProj, viewportClippedStartTimeProj, new ReduceTimeSinceLastDiff()); IProjection <int, double> weightPercentProj = Projection.VisibleDomainRelativePercent.Create(clippedWeightProj); IProjection <int, int> countProj = SequentialGenerator.Create( cpuClocks.Count, Projection.Constant(1), Projection.Constant(0)); table.AddColumn(weightColumn, weightProj); table.AddColumn(countColumn, countProj); table.AddColumn(weightPctColumn, weightPercentProj); table.AddColumn(startTimeCol, timeStampStartProjection); table.AddColumn(viewportClippedStartTimeCol, viewportClippedStartTimeProj); table.AddColumn(viewportClippedEndTimeCol, viewportClippedEndTimeProj); table.AddColumn(clippedWeightCol, clippedWeightProj); }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { int maximumFieldCount = tableData.QueryOutput <int>( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngGenericEventDataCooker.Identifier, nameof(LTTngGenericEventDataCooker.MaximumEventFieldCount))); var events = tableData.QueryOutput <ProcessedEventData <LTTngGenericEvent> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngGenericEventDataCooker.Identifier, nameof(LTTngGenericEventDataCooker.Events))); var tableGenerator = tableBuilder.SetRowCount((int)events.Count); var genericEventProjection = new EventProjection <LTTngGenericEvent>(events); var eventNameColumn = new DataColumn <string>( eventNameColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.EventName)); tableGenerator.AddColumn(eventNameColumn); var eventIdColumn = new DataColumn <uint>( eventIdColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.Id)); tableGenerator.AddColumn(eventIdColumn); var cpuIdColumn = new DataColumn <uint>( cpuIdColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.CpuId)); tableGenerator.AddColumn(cpuIdColumn); var discardedEventsColumn = new DataColumn <uint>( discardedEventsColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.DiscardedEvents)); tableGenerator.AddColumn(discardedEventsColumn); var eventTimestampColumn = new DataColumn <Timestamp>( eventTimestampColumnConfig, genericEventProjection.Compose((genericEvent) => genericEvent.Timestamp)); tableGenerator.AddColumn(eventTimestampColumn); tableGenerator.AddColumn(countColumnConfig, Projection.Constant(1)); // Add the field columns, with column names depending on the given event for (int index = 0; index < maximumFieldCount; index++) { var colIndex = index; // This seems unncessary but causes odd runtime behavior if not done this way. Compiler is confused perhaps because w/o this func will index=genericEvent.FieldNames.Count every time. index is passed as ref but colIndex as value into func string fieldName = "Field " + (colIndex + 1); var genericEventFieldNameProjection = genericEventProjection.Compose((genericEvent) => colIndex < genericEvent.FieldNames.Count ? genericEvent.FieldNames[colIndex] : string.Empty); // generate a column configuration var fieldColumnConfiguration = new ColumnConfiguration( new ColumnMetadata(Common.GenerateGuidFromName(fieldName), fieldName, genericEventFieldNameProjection, fieldName), new UIHints { IsVisible = true, Width = 80, TextAlignment = TextAlignment.Left, }); var genericEventFieldAsStringProjection = genericEventProjection.Compose((genericEvent) => colIndex < genericEvent.FieldNames.Count ? genericEvent.FieldValues[colIndex] : string.Empty); tableGenerator.AddColumn(fieldColumnConfiguration, genericEventFieldAsStringProjection); } }
public static bool IsDataAvailable(IDataExtensionRetrieval tableData) { return(tableData.QueryOutput <ProcessedEventData <LTTngGenericEvent> >( DataOutputPath.ForSource(LTTngConstants.SourceId, LTTngGenericEventDataCooker.Identifier, nameof(LTTngGenericEventDataCooker.Events))).Any()); }