示例#1
0
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            // Gather the data from all the SQL tables
            var threadData     = requiredData.QueryOutput <ProcessedEventData <PerfettoThreadEvent> >(new DataOutputPath(PerfettoPluginConstants.ThreadCookerPath, nameof(PerfettoThreadCooker.ThreadEvents)));
            var processData    = requiredData.QueryOutput <ProcessedEventData <PerfettoProcessRawEvent> >(new DataOutputPath(PerfettoPluginConstants.ProcessRawCookerPath, nameof(PerfettoProcessRawCooker.ProcessEvents)));
            var androidLogData = requiredData.QueryOutput <ProcessedEventData <PerfettoAndroidLogEvent> >(new DataOutputPath(PerfettoPluginConstants.AndroidLogCookerPath, nameof(PerfettoAndroidLogCooker.AndroidLogEvents)));

            // Join them all together

            // Log contains the information for each logcat message
            // Thread and process info are gathered from their respective tables
            var joined = from log in androidLogData
                         join thread in threadData on log.Utid equals thread.Utid
                         join process in processData on thread.Upid equals process.Upid
                         select new { log, thread, process };

            // Create events out of the joined results
            foreach (var result in joined)
            {
                PerfettoLogcatEvent ev = new PerfettoLogcatEvent
                                         (
                    new Timestamp(result.log.RelativeTimestamp),
                    result.process.Name,
                    result.thread.Name,
                    result.log.PriorityString,
                    result.log.Tag,
                    result.log.Message
                                         );
                this.LogcatEvents.AddEvent(ev);
            }
            this.LogcatEvents.FinalizeData();
        }
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            // Gather the data from all the SQL tables
            var threadData  = requiredData.QueryOutput <ProcessedEventData <PerfettoThreadEvent> >(new DataOutputPath(PerfettoPluginConstants.ThreadCookerPath, nameof(PerfettoThreadCooker.ThreadEvents)));
            var processData = requiredData.QueryOutput <ProcessedEventData <PerfettoProcessRawEvent> >(new DataOutputPath(PerfettoPluginConstants.ProcessRawCookerPath, nameof(PerfettoProcessRawCooker.ProcessEvents)));

            PopulateCpuSchedulingEvents(requiredData, threadData, processData);
        }
示例#3
0
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            // Gather the data from all the SQL tables
            var processData     = requiredData.QueryOutput <ProcessedEventData <PerfettoProcessRawEvent> >(new DataOutputPath(PerfettoPluginConstants.ProcessRawCookerPath, nameof(PerfettoProcessRawCooker.ProcessEvents)));
            var argData         = requiredData.QueryOutput <ProcessedEventData <PerfettoArgEvent> >(new DataOutputPath(PerfettoPluginConstants.ArgCookerPath, nameof(PerfettoArgCooker.ArgEvents)));
            var packageListData = requiredData.QueryOutput <ProcessedEventData <PerfettoPackageListEvent> >(new DataOutputPath(PerfettoPluginConstants.PackageListCookerPath, nameof(PerfettoPackageListCooker.PackageListEvents)));

            // Join them all together

            // Contains the information for each process entry with args
            var joined = from process in processData
                         join arg in argData on process.ArgSetId equals arg.ArgSetId into args
                         join packageList in packageListData on process.Uid equals packageList.Uid into pld
                         from packageList in pld.DefaultIfEmpty()
                         join parentProcess in processData on process.ParentUpid equals parentProcess.Upid into pp
                         from parentProcess in pp.DefaultIfEmpty()
                         select new { process, args, packageList, parentProcess };

            // Create events out of the joined results
            foreach (var result in joined)
            {
                var args = Args.ParseArgs(result.args);
                MaximumArgsEventFieldCount = Math.Max(MaximumArgsEventFieldCount, args.Count);

                const string ChromeProcessLabel = "chrome.process_label[0]";
                string       processLabel       = null;
                if (args.ContainsKey(ChromeProcessLabel))
                {
                    processLabel = (string)args[ChromeProcessLabel];
                }

                var ev = new PerfettoProcessEvent
                         (
                    result.process.Id,
                    result.process.Type,
                    result.process.Upid,
                    result.process.Pid,
                    result.process.Name,
                    processLabel,
                    result.process.RelativeStartTimestamp.HasValue ? new Timestamp(result.process.RelativeStartTimestamp.Value) : Timestamp.Zero,
                    result.process.RelativeEndTimestamp.HasValue ? new Timestamp(result.process.RelativeEndTimestamp.Value) : Timestamp.MaxValue,
                    result.process.ParentUpid,
                    result.parentProcess,
                    result.process.Uid,
                    result.process.AndroidAppId,
                    result.process.CmdLine,
                    args,
                    result.packageList
                         );
                this.ProcessEvents.AddEvent(ev);
            }
            this.ProcessEvents.FinalizeData();
        }
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            // Gather the data from all the SQL tables
            var rawData     = requiredData.QueryOutput <ProcessedEventData <PerfettoRawEvent> >(new DataOutputPath(PerfettoPluginConstants.RawCookerPath, nameof(PerfettoRawCooker.RawEvents)));
            var threadData  = requiredData.QueryOutput <ProcessedEventData <PerfettoThreadEvent> >(new DataOutputPath(PerfettoPluginConstants.ThreadCookerPath, nameof(PerfettoThreadCooker.ThreadEvents)));
            var processData = requiredData.QueryOutput <ProcessedEventData <PerfettoProcessRawEvent> >(new DataOutputPath(PerfettoPluginConstants.ProcessRawCookerPath, nameof(PerfettoProcessRawCooker.ProcessEvents)));
            var argsData    = requiredData.QueryOutput <ProcessedEventData <PerfettoArgEvent> >(new DataOutputPath(PerfettoPluginConstants.ArgCookerPath, nameof(PerfettoArgCooker.ArgEvents)));

            // Join them all together

            // Raw contains all the ftrace events, timestamps, and CPU
            // Arg contains a variable number of extra arguments for each event.
            // Thread and process info is contained in their respective tables
            var joined = from raw in rawData
                         join thread in threadData on raw.Utid equals thread.Utid
                         join threadProcess in processData on thread.Upid equals threadProcess.Upid into pd
                         from threadProcess in pd.DefaultIfEmpty()
                         join arg in argsData on raw.ArgSetId equals arg.ArgSetId into args
                         select new { raw, args, thread, threadProcess };

            // Create events out of the joined results
            foreach (var result in joined)
            {
                MaximumEventFieldCount = Math.Max(MaximumEventFieldCount, result.args.Count());
                var args = Args.ParseArgs(result.args);

                // An event can have a thread+process or just a process
                string processFormattedName = string.Empty;
                string threadFormattedName  = $"{result.thread.Name} ({result.thread.Tid})";
                if (result.threadProcess != null)
                {
                    processFormattedName = $"{result.threadProcess.Name} ({result.threadProcess.Pid})";
                }

                PerfettoFtraceEvent ev = new PerfettoFtraceEvent
                                         (
                    new Timestamp(result.raw.RelativeTimestamp),
                    processFormattedName,
                    threadFormattedName,
                    result.thread.Name,
                    result.thread.Tid,
                    result.raw.Cpu,
                    result.raw.Name,
                    args
                                         );
                this.FtraceEvents.AddEvent(ev);
            }
            this.FtraceEvents.FinalizeData();
        }
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            Debug.Assert(!(tableBuilder is null) && !(tableData is null));

            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            if (quicState == null)
            {
                return;
            }

            var events = quicState.Events
                         .Where(x => x.EventId == QuicEventId.DatapathSend || x.EventId == QuicEventId.DatapathRecv).ToArray();

            if (events.Length == 0)
            {
                return;
            }

            var table          = tableBuilder.SetRowCount(events.Length);
            var dataProjection = Projection.Index(events);

            table.AddColumn(processIdColumnConfig, dataProjection.Compose(ProjectProcessId));
            table.AddColumn(cpuColumnConfig, dataProjection.Compose(ProjectCPU));
            table.AddColumn(typeColumnConfig, dataProjection.Compose(ProjectType));
            table.AddColumn(timeColumnConfig, dataProjection.Compose(ProjectTime));
            table.AddColumn(bytesColumnConfig, dataProjection.Compose(ProjectBytes));

            tableConfig1.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableBuilder.AddTableConfiguration(tableConfig1);

            tableBuilder.SetDefaultTableConfiguration(tableConfig1);
        }
        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));
        }
示例#7
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            // Get data from the cooker
            var events = tableData.QueryOutput <ProcessedEventData <PerfettoPackageListEvent> >(
                new DataOutputPath(PerfettoPluginConstants.PackageListCookerPath, nameof(PerfettoPackageListCooker.PackageListEvents)));

            var tableGenerator = tableBuilder.SetRowCount((int)events.Count);
            var baseProjection = Projection.Index(events);

            tableGenerator.AddColumn(PackageNameColumn, baseProjection.Compose(x => x.PackageName));
            tableGenerator.AddColumn(UidColumn, baseProjection.Compose(x => x.Uid));
            tableGenerator.AddColumn(DebuggableColumn, baseProjection.Compose(x => x.Debuggable));
            tableGenerator.AddColumn(ProfileableFromShellColumn, baseProjection.Compose(x => x.ProfileableFromShell));
            tableGenerator.AddColumn(VersionCodeColumn, baseProjection.Compose(x => x.VersionCode));

            // Default
            List <ColumnConfiguration> defaultColumns = new List <ColumnConfiguration>()
            {
                PackageNameColumn,
                TableConfiguration.PivotColumn,     // Columns before this get pivotted on
                UidColumn,
                VersionCodeColumn,
                ProfileableFromShellColumn,
                TableConfiguration.GraphColumn,
            };

            var packageListDefaultConfig = new TableConfiguration("Default")
            {
                Columns   = defaultColumns,
                ChartType = ChartType.Line
            };

            tableBuilder.AddTableConfiguration(packageListDefaultConfig)
            .SetDefaultTableConfiguration(packageListDefaultConfig);
        }
示例#8
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            // Get data from the cooker
            var events = tableData.QueryOutput <ProcessedEventData <PerfettoGpuCountersEvent> >(
                new DataOutputPath(PerfettoPluginConstants.GpuCountersEventCookerPath, nameof(PerfettoGpuCountersEventCooker.GpuCountersEvents)));

            var tableGenerator = tableBuilder.SetRowCount((int)events.Count);
            var baseProjection = Projection.Index(events);

            tableGenerator.AddColumn(NameColumn, baseProjection.Compose(x => x.Name));
            tableGenerator.AddColumn(ValueColumn, baseProjection.Compose(x => x.Value));
            tableGenerator.AddColumn(StartTimestampColumn, baseProjection.Compose(x => x.StartTimestamp));
            tableGenerator.AddColumn(DurationColumn, baseProjection.Compose(x => x.Duration));

            var tableConfig = new TableConfiguration("GPU Counters")
            {
                Columns = new[]
                {
                    NameColumn,
                    TableConfiguration.PivotColumn, // Columns before this get pivotted on
                    StartTimestampColumn,
                    DurationColumn,
                    TableConfiguration.GraphColumn, // Columns after this get graphed
                    ValueColumn
                },
                ChartType = ChartType.Line
            };

            tableConfig.AddColumnRole(ColumnRole.StartTime, StartTimestampColumn.Metadata.Guid);
            tableConfig.AddColumnRole(ColumnRole.Duration, DurationColumn);

            tableBuilder
            .AddTableConfiguration(tableConfig)
            .SetDefaultTableConfiguration(tableConfig);
        }
示例#9
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            Debug.Assert(!(tableBuilder is null) && !(tableData is null));

            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            if (quicState == null)
            {
                return;
            }

            var events = quicState.Events
                         .Where(x => x.ID == QuicEventId.StreamCreated || x.ID == QuicEventId.StreamDestroyed).ToArray();

            if (events.Length == 0)
            {
                return;
            }

            var table          = tableBuilder.SetRowCount(events.Length);
            var dataProjection = Projection.Index(events);

            table.AddColumn(typeColumnConfig, dataProjection.Compose(ProjectType));
            table.AddColumn(countColumnConfig, Projection.Constant <uint>(1));
            table.AddColumn(timeColumnConfig, dataProjection.Compose(ProjectTime));

            tableConfig1.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableBuilder.AddTableConfiguration(tableConfig1);

            tableBuilder.SetDefaultTableConfiguration(tableConfig1);
        }
        public static bool IsDataAvailable(IDataExtensionRetrieval tableData)
        {
            Debug.Assert(!(tableData is null));
            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            return(quicState != null && quicState.DataAvailableFlags.HasFlag(QuicDataAvailableFlags.WorkerActivity));
        }
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            // Get data from the cooker
            var events = tableData.QueryOutput <ProcessedEventData <PerfettoFrameEvent> >(
                new DataOutputPath(PerfettoPluginConstants.FrameEventCookerPath, nameof(PerfettoFrameEventCooker.FrameEvents)));

            var tableGenerator = tableBuilder.SetRowCount((int)events.Count);
            var baseProjection = Projection.Index(events);

            var startProjection = baseProjection.Compose(x => x.StartTimestamp);
            var endProjection   = baseProjection.Compose(x => x.EndTimestamp);

            tableGenerator.AddColumn(ProcessNameColumn, baseProjection.Compose(x => x.ProcessName));
            tableGenerator.AddColumn(ProcessIdColumn, baseProjection.Compose(x => x.Upid));
            tableGenerator.AddColumn(FrameTypeColumn, baseProjection.Compose(x => x.FrameType));
            tableGenerator.AddColumn(JankTypeColumn, baseProjection.Compose(x => x.JankType));
            tableGenerator.AddColumn(OnTimeFinishColumn, baseProjection.Compose(x => x.OnTimeFinish));
            tableGenerator.AddColumn(DurationColumn, baseProjection.Compose(x => x.Duration));
            tableGenerator.AddColumn(DisplayTokenColumn, baseProjection.Compose(x => x.DisplayFrameToken));
            tableGenerator.AddColumn(SurfaceTokenColumn, baseProjection.Compose(x => x.SurfaceFrameToken));
            tableGenerator.AddColumn(PresentTypeColumn, baseProjection.Compose(x => x.PresentType));
            tableGenerator.AddColumn(PredictionTypeColumn, baseProjection.Compose(x => x.PredictionType));
            tableGenerator.AddColumn(GpuCompositionColumn, baseProjection.Compose(x => x.GpuComposition));
            tableGenerator.AddColumn(JankTagColumn, baseProjection.Compose(x => x.JankTag));
            tableGenerator.AddColumn(StartTimestampColumn, startProjection);
            tableGenerator.AddColumn(EndTimestampColumn, endProjection);


            var jankFramesConfig = new TableConfiguration("Expected/Actual Frames by Process")
            {
                Columns = new[]
                {
                    ProcessNameColumn,
                    DisplayTokenColumn,
                    SurfaceTokenColumn,
                    FrameTypeColumn,
                    TableConfiguration.PivotColumn, // Columns before this get pivotted on
                    PresentTypeColumn,
                    OnTimeFinishColumn,
                    PredictionTypeColumn,
                    JankTypeColumn,
                    JankTagColumn,
                    GpuCompositionColumn,
                    ProcessIdColumn,
                    DurationColumn,
                    TableConfiguration.GraphColumn, // Columns after this get graphed
                    StartTimestampColumn,
                    EndTimestampColumn
                },
            };

            jankFramesConfig.AddColumnRole(ColumnRole.StartTime, StartTimestampColumn.Metadata.Guid);
            jankFramesConfig.AddColumnRole(ColumnRole.EndTime, EndTimestampColumn.Metadata.Guid);
            jankFramesConfig.AddColumnRole(ColumnRole.Duration, DurationColumn.Metadata.Guid);

            tableBuilder
            .AddTableConfiguration(jankFramesConfig)
            .SetDefaultTableConfiguration(jankFramesConfig);
        }
示例#12
0
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            // Gather the data from all the SQL tables
            var counterData      = requiredData.QueryOutput <ProcessedEventData <PerfettoCounterEvent> >(new DataOutputPath(PerfettoPluginConstants.CounterCookerPath, nameof(PerfettoCounterCooker.CounterEvents)));
            var counterTrackData = requiredData.QueryOutput <ProcessedEventData <PerfettoCounterTrackEvent> >(new DataOutputPath(PerfettoPluginConstants.CounterTrackCookerPath, nameof(PerfettoCounterTrackCooker.CounterTrackEvents)));

            // Join them all together
            // Counter table contains the memory count value, timestamp
            // counterTrackData contains the name of the memory type
            // Process contains the process name
            var joined = from counter in counterData
                         join counterTrack in counterTrackData on counter.TrackId equals counterTrack.Id
                         where MemoryTypes.Contains(counterTrack.Name)
                         orderby counter.Timestamp ascending
                         select new { counter, counterTrack };

            // Create events out of the joined results
            foreach (var memoryGroup in joined.GroupBy(x => x.counterTrack.Name))
            {
                string memoryType = memoryGroup.Key;

                for (int i = 0; i < memoryGroup.Count(); i++)
                {
                    var    thing = memoryGroup.ElementAt(i);
                    double val   = thing.counter.FloatValue;
                    var    ts    = thing.counter.RelativeTimestamp;

                    long nextTs = ts;
                    if (i < memoryGroup.Count() - 1)
                    {
                        // Need to look ahead in the future at the next event to get the timestamp so that we can calculate the duration
                        nextTs = memoryGroup.ElementAt(i + 1).counter.RelativeTimestamp;
                    }

                    PerfettoSystemMemoryEvent ev = new PerfettoSystemMemoryEvent
                                                   (
                        val,
                        memoryType,
                        new Timestamp(ts),
                        new TimestampDelta(nextTs - ts)
                                                   );
                    this.SystemMemoryEvents.AddEvent(ev);
                }
            }
            this.SystemMemoryEvents.FinalizeData();
        }
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            // Gather the data from all the SQL tables
            var counterData         = requiredData.QueryOutput <ProcessedEventData <PerfettoCounterEvent> >(new DataOutputPath(PerfettoPluginConstants.CounterCookerPath, nameof(PerfettoCounterCooker.CounterEvents)));
            var gpuCounterTrackData = requiredData.QueryOutput <ProcessedEventData <PerfettoGpuCounterTrackEvent> >(new DataOutputPath(PerfettoPluginConstants.GpuCounterTrackCookerPath, nameof(PerfettoGpuCounterTrackCooker.GpuCounterTrackEvents)));

            // Join them all together
            // Counter table contains the timestamp and all counter values
            // GpuCounterTrack contains the counter name
            var joined = from counter in counterData
                         join gpuCounterTrack in gpuCounterTrackData on counter.TrackId equals gpuCounterTrack.Id
                         orderby counter.Timestamp ascending
                         select new { counter, gpuCounterTrack };

            // Create GPU Counter events for each type (name) at each time
            foreach (var nameGroup in joined.GroupBy(x => x.gpuCounterTrack.Name))
            {
                string name = nameGroup.Key;

                for (int i = 0; i < nameGroup.Count(); i++)
                {
                    var    ele = nameGroup.ElementAt(i);
                    double val = ele.counter.FloatValue;
                    var    ts  = ele.counter.RelativeTimestamp;

                    long nextTs = ts;
                    if (i < nameGroup.Count() - 1)
                    {
                        // Need to look ahead in the future at the next event to get the timestamp so that we can calculate the duration
                        nextTs = nameGroup.ElementAt(i + 1).counter.RelativeTimestamp;
                    }

                    PerfettoGpuCountersEvent ev = new PerfettoGpuCountersEvent
                                                  (
                        name,
                        val,
                        new Timestamp(ts),
                        new TimestampDelta(nextTs - ts)
                                                  );
                    this.GpuCountersEvents.AddEvent(ev);
                }
            }

            this.GpuCountersEvents.FinalizeData();
        }
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            WaLinuxAgentLogParsedResult parsedResult = tableData.QueryOutput <WaLinuxAgentLogParsedResult>(
                DataOutputPath.Create(SourceParserIds.WaLinuxAgentLog, WaLinuxAgentDataCooker.CookerId, "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,
                },
                Layout = TableLayoutStyle.GraphAndTable,
            };

            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)
        {
            Debug.Assert(!(tableBuilder is null) && !(tableData is null));

            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            if (quicState == null)
            {
                return;
            }

            var connections = quicState.Connections;

            if (connections.Count == 0)
            {
                return;
            }

            var connData =
                connections.SelectMany(
                    x => x.GetFlowBlockedEvents()
                    .Where(x => x.Flags != QuicFlowBlockedFlags.None)
                    .Select(y => new Data(x, y)));
            var streamData =
                connections.SelectMany(
                    x => x.Streams.SelectMany(
                        y => y.GetFlowBlockedEvents()
                        .Where(z => z.Flags != QuicFlowBlockedFlags.None)
                        .Select(z => new Data(x, z, y))));
            var data = connData.Concat(streamData).ToArray();

            var table          = tableBuilder.SetRowCount(data.Length);
            var dataProjection = Projection.Index(data);

            table.AddColumn(connectionColumnConfig, dataProjection.Compose(ProjectId));
            table.AddColumn(streamColumnConfig, dataProjection.Compose(ProjectStreamId));
            table.AddColumn(processIdColumnConfig, dataProjection.Compose(ProjectProcessId));
            table.AddColumn(reasonColumnConfig, dataProjection.Compose(ProjectReason));
            table.AddColumn(countColumnConfig, Projection.Constant <uint>(1));
            table.AddColumn(weightColumnConfig, dataProjection.Compose(ProjectWeight));
            table.AddColumn(percentWeightColumnConfig, dataProjection.Compose(ProjectPercentWeight));
            table.AddColumn(timeColumnConfig, dataProjection.Compose(ProjectTime));
            table.AddColumn(durationColumnConfig, dataProjection.Compose(ProjectDuration));

            tableConfig1.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig1.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            tableConfig1.InitialSelectionQuery = "[Series Name]:=\"Connection\" OR [Series Name]:=\"Reason\"";
            tableBuilder.AddTableConfiguration(tableConfig1);

            tableConfig2.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig2.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            tableConfig2.InitialSelectionQuery = "[Series Name]:=\"Reason\"";
            tableBuilder.AddTableConfiguration(tableConfig2);

            tableBuilder.SetDefaultTableConfiguration(tableConfig1);
        }
示例#16
0
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            var source5Data = requiredData.QueryOutput <List <Source5DataObject> >(
                new DataOutputPath(
                    Source5DataCooker.DataCookerPath,
                    nameof(Source5DataCooker.Objects)));
            var composite1Data = requiredData.QueryOutput <List <Composite1Output> >(
                new DataOutputPath(
                    Composite1Cooker.DataCookerPath,
                    nameof(Composite1Cooker.Output)));

            this.Output.Add(
                new Composite3Output
            {
                Key             = source5Data.Count + composite1Data.Count,
                Composite1Count = composite1Data.Count,
                Source5Count    = source5Data.Count,
            });
        }
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            var threads = tableData.QueryOutput <IReadOnlyList <IThread> >(
                DataOutputPath.Create(LTTngThreadDataCooker.CookerPath + "/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
                },
                Layout = TableLayoutStyle.GraphAndTable,
            };

            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.Create(SourceParserIds.CloudInitLog, CloudInitDataCooker.CookerId, "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,
                },
                Layout = TableLayoutStyle.GraphAndTable,
            };

            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)
            ;
        }
示例#19
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            Debug.Assert(!(tableBuilder is null) && !(tableData is null));

            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            if (quicState == null)
            {
                return;
            }

            var connections = quicState.Connections;

            if (connections.Count == 0)
            {
                return;
            }

            var data = connections.SelectMany(
                x => x.GetExecutionEvents().Select(
                    y => new ValueTuple <QuicConnection, QuicExecutionData>(x, y))).ToArray();

            var table          = tableBuilder.SetRowCount(data.Length);
            var dataProjection = Projection.Index(data);

            table.AddColumn(connectionColumnConfig, dataProjection.Compose(ProjectId));
            table.AddColumn(processIdColumnConfig, dataProjection.Compose(ProjectProcessId));
            table.AddColumn(threadIdColumnConfig, dataProjection.Compose(ProjectThreadId));
            table.AddColumn(cpuColumnConfig, dataProjection.Compose(ProjectCpu));
            table.AddColumn(nameColumnConfig, dataProjection.Compose(ProjectName));
            table.AddColumn(countColumnConfig, Projection.Constant <uint>(1));
            table.AddColumn(weightColumnConfig, dataProjection.Compose(ProjectWeight));
            table.AddColumn(percentWeightColumnConfig, dataProjection.Compose(ProjectPercentWeight));
            table.AddColumn(timeColumnConfig, dataProjection.Compose(ProjectTime));
            table.AddColumn(durationColumnConfig, dataProjection.Compose(ProjectDuration));

            tableConfig1.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig1.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            //tableConfig1.InitialExpansionQuery = "[Series Name]:=\"Process (ID)\"";
            //tableConfig1.InitialSelectionQuery = "[Series Name]:=\"Connection\" OR [Series Name]:=\"State\"";
            tableBuilder.AddTableConfiguration(tableConfig1);

            tableConfig2.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig2.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            tableConfig2.AddColumnRole(ColumnRole.ResourceId, cpuColumnConfig);
            //tableConfig2.InitialExpansionQuery = "[Series Name]:=\"Process (ID)\"";
            //tableConfig2.InitialSelectionQuery = "[Series Name]:=\"State\"";
            tableBuilder.AddTableConfiguration(tableConfig2);

            tableBuilder.SetDefaultTableConfiguration(tableConfig1);
        }
示例#20
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            Debug.Assert(!(tableBuilder is null) && !(tableData is null));

            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            var data = quicState.Connections.SelectMany(
                x => x.GetRawTputEvents().Select(y => new ValueTuple <QuicConnection, QuicRawTputData>(x, y))).ToArray();

            var table          = tableBuilder.SetRowCount(data.Length);
            var dataProjection = Projection.Index(data);

            table.AddColumn(connectionColumnConfig, dataProjection.Compose(ProjectId));
            table.AddColumn(processIdColumnConfig, dataProjection.Compose(ProjectProcessId));
            table.AddColumn(typeColumnConfig, dataProjection.Compose(ProjectType));
            table.AddColumn(timeColumnConfig, dataProjection.Compose(ProjectTime));
            table.AddColumn(durationColumnConfig, dataProjection.Compose(ProjectDuration));
            table.AddColumn(bitsColumnConfig, dataProjection.Compose(ProjectBits));
            table.AddColumn(bytesColumnConfig, dataProjection.Compose(ProjectBytes));
            table.AddColumn(rttColumnConfig, dataProjection.Compose(ProjectRtt));
            table.AddColumn(txDelayColumnConfig, dataProjection.Compose(ProjectTxDelay));

            tableConfig1.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig1.InitialSelectionQuery = "[Type]:=\"Tx\" OR [Type]:=\"Rx\"";
            tableConfig1.InitialFilterQuery    = "[Type]:<>\"Tx\" AND [Type]:<>\"PktCreate\" AND [Type]:<>\"TxAck\" AND [Type]:<>\"Rx\"";
            tableBuilder.AddTableConfiguration(tableConfig1);

            tableConfig2.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig2.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            tableConfig2.InitialSelectionQuery = "[Type]:=\"InFlight\"";
            tableConfig2.InitialFilterQuery    =
                "[Type]:=\"Tx\" OR [Type]:=\"TxAck\" OR [Type]:=\"PktCreate\" OR [Type]:=\"Rx\" OR [Type]:=\"Rtt\" OR [Type]:=\"TxDelay\"";
            tableBuilder.AddTableConfiguration(tableConfig2);

            tableConfig3.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig3.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            tableConfig3.InitialFilterQuery = "[Type]:<>\"Rtt\"";
            tableBuilder.AddTableConfiguration(tableConfig3);

            tableConfig4.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig4.InitialSelectionQuery = "[Type]:=\"Tx\" OR [Type]:=\"Rx\"";
            tableConfig4.InitialFilterQuery    =
                "[Type]:<>\"Tx\" AND [Type]:<>\"TxAck\" AND [Type]:<>\"PktCreate\" AND [Type]:<>\"Rx\"";
            tableBuilder.AddTableConfiguration(tableConfig4);

            tableConfig5.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig5.InitialFilterQuery = "[Type]:<>\"TxDelay\"";
            tableBuilder.AddTableConfiguration(tableConfig5);

            tableBuilder.SetDefaultTableConfiguration(tableConfig1);
        }
        public void OnDataAvailable(IDataExtensionRetrieval requiredData)
        {
            // Gather the data from all the SQL tables
            var threadData  = requiredData.QueryOutput <ProcessedEventData <PerfettoThreadEvent> >(new DataOutputPath(PerfettoPluginConstants.ThreadCookerPath, nameof(PerfettoThreadCooker.ThreadEvents)));
            var processData = requiredData.QueryOutput <ProcessedEventData <PerfettoProcessRawEvent> >(new DataOutputPath(PerfettoPluginConstants.ProcessRawCookerPath, nameof(PerfettoProcessRawCooker.ProcessEvents)));

            var perfSampleData           = requiredData.QueryOutput <ProcessedEventData <PerfettoPerfSampleEvent> >(new DataOutputPath(PerfettoPluginConstants.PerfSampleCookerPath, nameof(PerfettoPerfSampleCooker.PerfSampleEvents)));
            var stackProfileCallSiteData = requiredData.QueryOutput <ProcessedEventData <PerfettoStackProfileCallSiteEvent> >(new DataOutputPath(PerfettoPluginConstants.StackProfileCallSiteCookerPath, nameof(PerfettoStackProfileCallSiteCooker.StackProfileCallSiteEvents)));
            var stackProfileFrameData    = requiredData.QueryOutput <ProcessedEventData <PerfettoStackProfileFrameEvent> >(new DataOutputPath(PerfettoPluginConstants.StackProfileFrameCookerPath, nameof(PerfettoStackProfileFrameCooker.StackProfileFrameEvents)));
            var stackProfileMappingData  = requiredData.QueryOutput <ProcessedEventData <PerfettoStackProfileMappingEvent> >(new DataOutputPath(PerfettoPluginConstants.StackProfileMappingCookerPath, nameof(PerfettoStackProfileMappingCooker.StackProfileMappingEvents)));

            // stackProfileSymbolData doesn't seem to have data now in the traces we have seen
            //var stackProfileSymbolData = requiredData.QueryOutput<ProcessedEventData<PerfettoStackProfileSymbolEvent>>(new DataOutputPath(PerfettoPluginConstants.StackProfileSymbolCookerPath, nameof(PerfettoStackProfileSymbolCooker.StackProfileSymbolEvents)));

            // We need to join a bunch of tables to get the cpu samples with stack and module information
            var joined = from perfSample in perfSampleData
                         join thread in threadData on perfSample.Utid equals thread.Id
                         join threadProcess in processData on thread.Upid equals threadProcess.Upid
                         into pd
                         from threadProcess in pd.DefaultIfEmpty()         // left outer
                         select new { perfSample, thread, threadProcess }; // stackProfileCallSite

            var stackWalker = new StackWalk(stackProfileCallSiteData, stackProfileFrameData, stackProfileMappingData);

            // Create events out of the joined results
            foreach (var result in joined)
            {
                // Walk the stack
                StackWalkResult stackWalkResult = null;
                if (result.perfSample.CallsiteId.HasValue)
                {
                    stackWalkResult = stackWalker.WalkStack(result.perfSample.CallsiteId.Value);
                }

                // An event can have a thread+process or just a process
                string processName = string.Empty;
                string threadName  = $"{result.thread.Name} ({result.thread.Tid})";
                if (result.threadProcess != null)
                {
                    processName = $"{result.threadProcess.Name} ({result.threadProcess.Pid})";
                }

                var ev = new PerfettoCpuSamplingEvent
                         (
                    processName,
                    threadName,
                    new Timestamp(result.perfSample.RelativeTimestamp),
                    result.perfSample.Cpu,
                    result.perfSample.CpuMode,
                    result.perfSample.UnwindError,
                    stackWalkResult?.Stack,
                    stackWalkResult?.Module,
                    stackWalkResult?.Function
                         );
                this.CpuSamplingEvents.AddEvent(ev);
            }
            this.CpuSamplingEvents.FinalizeData();
        }
示例#22
0
        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)
        {
            DmesgIsoLogParsedResult parsedResult = tableData.QueryOutput <DmesgIsoLogParsedResult>(
                DataOutputPath.Create(SourceParserIds.DmesgIsoLog, DmesgIsoDataCooker.CookerId, "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);
        }
示例#24
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            var parsedResult = tableData.QueryOutput <AndroidLogcatParsedResult>(
                DataOutputPath.ForSource(SourceParserIds.AndroidLogcatLog, AndroidLogcatDataCooker.CookerId, nameof(AndroidLogcatDataCooker.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);
        }
示例#25
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            Debug.Assert(!(tableBuilder is null) && !(tableData is null));

            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            if (quicState == null)
            {
                return;
            }

            var connections = quicState.Connections;

            if (connections.Count == 0)
            {
                return;
            }

            var data = new List <Data>();

            foreach (var conn in connections)
            {
                foreach (var evt in conn.GetThroughputEvents())
                {
                    data.Add(new Data(conn, "InFlight", evt.TimeStamp, evt.Duration, evt.BytesInFlight));
                    data.Add(new Data(conn, "Buffered", evt.TimeStamp, evt.Duration, evt.BytesBufferedForSend));
                    data.Add(new Data(conn, "CongestionWindow", evt.TimeStamp, evt.Duration, evt.CongestionWindow));
                    data.Add(new Data(conn, "ConnectionFlowControl", evt.TimeStamp, evt.Duration, evt.FlowControlAvailable));
                    data.Add(new Data(conn, "StreamFlowControl", evt.TimeStamp, evt.Duration, evt.StreamFlowControlAvailable));
                }
            }

            var table          = tableBuilder.SetRowCount(data.Count);
            var dataProjection = Projection.Index(data);

            table.AddColumn(connectionColumnConfig, dataProjection.Compose(ProjectId));
            table.AddColumn(processIdColumnConfig, dataProjection.Compose(ProjectProcessId));
            table.AddColumn(typeColumnConfig, dataProjection.Compose(ProjectType));
            table.AddColumn(timeColumnConfig, dataProjection.Compose(ProjectTime));
            table.AddColumn(durationColumnConfig, dataProjection.Compose(ProjectDuration));
            table.AddColumn(bytesColumnConfig, dataProjection.Compose(ProjectBytes));

            tableConfig1.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig1.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            tableConfig1.InitialSelectionQuery = "[Type]:=\"InFlight\"";
            tableBuilder.AddTableConfiguration(tableConfig1);

            tableBuilder.SetDefaultTableConfiguration(tableConfig1);
        }
        void PopulateCpuWakeEvents(IDataExtensionRetrieval requiredData, ProcessedEventData <PerfettoThreadEvent> threadData, ProcessedEventData <PerfettoProcessRawEvent> processData)
        {
            var schedWakeData = requiredData.QueryOutput <ProcessedEventData <PerfettoFtraceEvent> >(new DataOutputPath(PerfettoPluginConstants.FtraceEventCookerPath, nameof(PerfettoFtraceEventCooker.FtraceEvents)))
                                .Where(f => f.Name == "sched_wakeup");

            Dictionary <uint, PerfettoThreadEvent> tidToThreadMap = threadData
                                                                    .ToLookup(t => t.Tid)
                                                                    .ToDictionary(tg => tg.Key, tg => tg.Last());
            Dictionary <uint, PerfettoProcessRawEvent> upidToProcessMap = processData
                                                                          .ToLookup(p => p.Upid)
                                                                          .ToDictionary(pg => pg.Key, pg => pg.Last());

            // Create events out of the joined results
            foreach (var wake in schedWakeData)
            {
                var wokenTid = uint.Parse(wake.Args.ElementAt(1).Value.ToString()); // This field name is pid but it is woken thread's Tid.
                PerfettoThreadEvent wokenThread = tidToThreadMap[wokenTid];
                string wokenThreadName          = wokenThread.Name;
                var    wokenPid         = wokenThread.Upid;
                string wokenProcessName = wokenPid != null ? upidToProcessMap[wokenPid.Value].Name : wake.Args.ElementAt(0).Value.ToString(); // This field name is comms but it is woken process name.

                string wakerThreadName          = wake.ThreadName;
                var    wakerTid                 = wake.Tid;
                PerfettoThreadEvent wakerThread = tidToThreadMap[wakerTid];
                var    wakerPid                 = wakerThread.Upid;
                string wakerProcessName         = wakerPid != null ? upidToProcessMap[wakerPid.Value].Name : String.Empty;

                PerfettoCpuWakeEvent ev = new PerfettoCpuWakeEvent
                                          (
                    wokenProcessName: wokenProcessName,
                    wokenPid: wokenPid,
                    wokenThreadName: wokenThreadName,
                    wokenTid: wokenTid,
                    wakerProcessName: wakerProcessName,
                    wakerPid: wakerPid,
                    wakerThreadName: wakerThreadName,
                    wakerTid: wakerTid,
                    timestamp: wake.StartTimestamp,
                    success: int.Parse(wake.Args.ElementAt(3).Value.ToString()),   // Success is at index 3
                    cpu: wake.Cpu,
                    targetCpu: int.Parse(wake.Args.ElementAt(4).Value.ToString()), // TargetCpu is at index 4
                    priority: int.Parse(wake.Args.ElementAt(2).Value.ToString())   // Priority is at index 2
                                          );

                this.CpuWakeEvents.AddEvent(ev);
            }

            this.CpuWakeEvents.FinalizeData();
        }
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            var syscalls = tableData.QueryOutput <IReadOnlyList <ISyscall> >(
                DataOutputPath.Create(LTTngSyscallDataCooker.CookerPath + '/' + 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
                },
                Layout = TableLayoutStyle.GraphAndTable,
            };

            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));
        }
示例#28
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            DmesgIsoLogParsedResult parsedResult = tableData.QueryOutput <DmesgIsoLogParsedResult>(
                DataOutputPath.Create(SourceParserIds.DmesgIsoLog, DmesgIsoDataCooker.CookerId, "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
                },
                Layout = TableLayoutStyle.GraphAndTable,
            };

            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.Create(LTTngDiskDataCooker.CookerPath + '/' + 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
                },
                Layout = TableLayoutStyle.GraphAndTable,
            };

            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])));
        }
示例#30
0
        public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData)
        {
            Debug.Assert(!(tableBuilder is null) && !(tableData is null));

            var quicState = tableData.QueryOutput <QuicState>(new DataOutputPath(QuicEventCooker.CookerPath, "State"));

            if (quicState == null)
            {
                return;
            }

            var connections = quicState.Connections;

            if (connections.Count == 0)
            {
                return;
            }

            var data = new List <Data>();

            foreach (var conn in connections)
            {
                foreach (var evt in conn.GetThroughputEvents())
                {
                    data.Add(new Data(conn, true, evt.TimeStamp, evt.Duration, evt.TxRate));
                    data.Add(new Data(conn, false, evt.TimeStamp, evt.Duration, evt.RxRate));
                }
            }

            var table          = tableBuilder.SetRowCount(data.Count);
            var dataProjection = Projection.Index(data);

            table.AddColumn(connectionColumnConfig, dataProjection.Compose(ProjectId));
            table.AddColumn(processIdColumnConfig, dataProjection.Compose(ProjectProcessId));
            table.AddColumn(typeColumnConfig, dataProjection.Compose(ProjectType));
            table.AddColumn(timeColumnConfig, dataProjection.Compose(ProjectTime));
            table.AddColumn(durationColumnConfig, dataProjection.Compose(ProjectDuration));
            table.AddColumn(rateColumnConfig, dataProjection.Compose(ProjectRate));

            tableConfig1.AddColumnRole(ColumnRole.StartTime, timeColumnConfig);
            tableConfig1.AddColumnRole(ColumnRole.Duration, durationColumnConfig);
            tableConfig1.InitialSelectionQuery = "[Series Name]:=\"Type\"";
            tableBuilder.AddTableConfiguration(tableConfig1);

            tableBuilder.SetDefaultTableConfiguration(tableConfig1);
        }