Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace CloudInitMPTAddin.Tables.Metadata
public sealed class FileStatsMetadataTable
{
public static readonly TableDescriptor TableDescriptor = new TableDescriptor(
Guid.Parse("{40AF86E5-0DF8-47B1-9A01-1D6C3529B75B}"),
Guid.Parse("{806a2599-97a2-4ff7-9ed8-9ac891edeef6}"),
"File Stats",
"Statistics for text files",
isMetadataTable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace WaLinuxAgentMPTAddin.Tables.Metadata
public static class FileStatsMetadataTable
{
public static readonly TableDescriptor TableDescriptor = new TableDescriptor(
Guid.Parse("{40AF86E5-0DF8-47B1-9A01-1D6C3529B75B}"),
Guid.Parse("{10a8a80a-27a3-42b8-8cde-3a374080e01e}"),
"File Stats",
"Statistics for text files",
isMetadataTable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using PerfettoCds.Pipeline.DataOutput;
using PerfettoCds.Pipeline.SourceDataCookers;
using PerfettoProcessor;
using Utilities;

namespace PerfettoCds.Pipeline.CompositeDataCookers
{
Expand Down Expand Up @@ -78,23 +79,23 @@ join arg in argsData on raw.ArgSetId equals arg.ArgSetId into args
// Each event has multiple of these arguments. They get stored in lists
foreach (var arg in result.args)
{
argKeys.Add(arg.ArgKey);
argKeys.Add(Common.StringIntern(arg.ArgKey));
switch (arg.ValueType)
{
case "json":
case "string":
values.Add(arg.StringValue);
values.Add(Common.StringIntern(arg.StringValue));
break;
case "bool":
case "int":
values.Add(arg.IntValue.ToString());
values.Add(Common.StringIntern(arg.IntValue.ToString()));
break;
case "uint":
case "pointer":
values.Add(((uint)arg.IntValue).ToString());
values.Add(Common.StringIntern(((uint)arg.IntValue).ToString()));
break;
case "real":
values.Add(arg.RealValue.ToString());
values.Add(Common.StringIntern(arg.RealValue.ToString()));
break;
default:
throw new Exception("Unexpected Perfetto value type");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using PerfettoCds.Pipeline.DataOutput;
using PerfettoCds.Pipeline.SourceDataCookers;
using PerfettoProcessor;
using Utilities;

namespace PerfettoCds.Pipeline.CompositeDataCookers
{
Expand Down Expand Up @@ -188,12 +189,12 @@ join processTrack in processTrackData on slice.TrackId equals processTrack.Id in
// Each event has multiple of these "debug annotations". They get stored in lists
foreach (var arg in result.args)
{
argKeys.Add(arg.ArgKey);
argKeys.Add(Common.StringIntern(arg.ArgKey));
switch (arg.ValueType)
{
case "json":
case "string":
values.Add(arg.StringValue);
values.Add(Common.StringIntern(arg.StringValue));

// Check if there are mappings present and if the arg key is the keyword we're looking for
if (ProviderGuidMapping.Count > 0 && arg.ArgKey.ToLower().Contains(ProviderDebugAnnotationKey))
Expand All @@ -210,14 +211,14 @@ join processTrack in processTrackData on slice.TrackId equals processTrack.Id in
break;
case "bool":
case "int":
values.Add(arg.IntValue.ToString());
values.Add(Common.StringIntern(arg.IntValue.ToString()));
break;
case "uint":
case "pointer":
values.Add(((uint)arg.IntValue).ToString());
values.Add(Common.StringIntern(((uint)arg.IntValue).ToString()));
break;
case "real":
values.Add(arg.RealValue.ToString());
values.Add(Common.StringIntern(arg.RealValue.ToString()));
break;
default:
throw new Exception("Unexpected Perfetto value type");
Expand Down Expand Up @@ -282,7 +283,6 @@ join processTrack in processTrackData on slice.TrackId equals processTrack.Id in
new Timestamp(result.slice.RelativeTimestamp + result.slice.Duration) :
longestEndTs,
result.slice.Category,
result.slice.ArgSetId,
values,
argKeys,
processName,
Expand Down
6 changes: 3 additions & 3 deletions PerfettoCds/Pipeline/DataOutput/PerfettoCpuCountersEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace PerfettoCds.Pipeline.DataOutput
public readonly struct PerfettoCpuCountersEvent
{
// The specific CPU core
public long CpuNum { get; }
public int CpuNum { get; }
public Timestamp StartTimestamp { get; }
public TimestampDelta Duration { get; }

Expand Down Expand Up @@ -36,7 +36,7 @@ public readonly struct PerfettoCpuCountersEvent
/// <summary>
/// For populating the current counter values
/// </summary>
public PerfettoCpuCountersEvent(long cpuNum, Timestamp startTimestamp, TimestampDelta duration,
public PerfettoCpuCountersEvent(int cpuNum, Timestamp startTimestamp, TimestampDelta duration,
double userNs,
double userNiceNs,
double systemModeNs,
Expand Down Expand Up @@ -70,7 +70,7 @@ public PerfettoCpuCountersEvent(long cpuNum, Timestamp startTimestamp, Timestamp
/// <summary>
/// When we have a previous event to compare to, we can calculate the percent change
/// </summary>
public PerfettoCpuCountersEvent(long cpuNum, Timestamp startTimestamp, TimestampDelta duration,
public PerfettoCpuCountersEvent(int cpuNum, Timestamp startTimestamp, TimestampDelta duration,
double userNs,
double userNiceNs,
double systemModeNs,
Expand Down
4 changes: 2 additions & 2 deletions PerfettoCds/Pipeline/DataOutput/PerfettoCpuFrequencyEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public readonly struct PerfettoCpuFrequencyEvent
// The current frequency of this CPU
public double CpuFrequency { get; }
// The specific CPU core
public long CpuNum { get; }
public int CpuNum { get; }
public Timestamp StartTimestamp { get; }
// Type of CPU frequency event. Whether it's an idle change or frequency change event
public string Name { get; }
public TimestampDelta Duration { get; }
public bool IsIdle { get; }

public PerfettoCpuFrequencyEvent(double cpuFrequency, long cpuNum, Timestamp startTimestamp, TimestampDelta duration, string name, bool isIdle)
public PerfettoCpuFrequencyEvent(double cpuFrequency, int cpuNum, Timestamp startTimestamp, TimestampDelta duration, string name, bool isIdle)
{
this.CpuFrequency = cpuFrequency;
this.CpuNum = cpuNum;
Expand Down
13 changes: 7 additions & 6 deletions PerfettoCds/Pipeline/DataOutput/PerfettoCpuSchedEvent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.Performance.SDK;
using Utilities;

namespace PerfettoCds.Pipeline.DataOutput
{
Expand All @@ -14,21 +15,21 @@ public readonly struct PerfettoCpuSchedEvent
public TimestampDelta Duration { get; }
public Timestamp StartTimestamp { get; }
public Timestamp EndTimestamp { get; }
public long Cpu { get; }
public int Cpu { get; }
public string EndState { get; }
public long Priority { get; }
public int Priority { get; }

public PerfettoCpuSchedEvent(string processName,
string threadName,
TimestampDelta duration,
Timestamp startTimestamp,
Timestamp endTimestamp,
long cpu,
int cpu,
string endState,
long priority)
int priority)
{
this.ProcessName = processName;
this.ThreadName = threadName;
this.ProcessName = Common.StringIntern(processName);
this.ThreadName = Common.StringIntern(threadName);
this.Duration = duration;
this.StartTimestamp = startTimestamp;
this.EndTimestamp = endTimestamp;
Expand Down
19 changes: 10 additions & 9 deletions PerfettoCds/Pipeline/DataOutput/PerfettoFtraceEvent.cs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.
using Microsoft.Performance.SDK;
using System.Collections.Generic;
using Utilities;

namespace PerfettoCds.Pipeline.DataOutput
{
Expand All @@ -13,29 +14,29 @@ public readonly struct PerfettoFtraceEvent
public Timestamp StartTimestamp { get; }
public string ProcessName { get; }
public string ThreadName { get; }
public long Cpu { get; }
public int Cpu { get; }
// Name of the ftrace event
public string Name { get; }

// From Args table. Variable number per event
public List<string> Values { get; }
public List<string> ArgKeys { get; }
public string[] Values { get; }
public string[] ArgKeys { get; }

public PerfettoFtraceEvent(Timestamp startTimestamp,
string processName,
string threadName,
long cpu,
int cpu,
string name,
List<string> values,
List<string> argKeys)
{
this.StartTimestamp = startTimestamp;
this.ProcessName = processName;
this.ThreadName = threadName;
this.ProcessName = Common.StringIntern(processName);
this.ThreadName = Common.StringIntern(threadName);
this.Cpu = cpu;
this.Name = name;
this.Values = values;
this.ArgKeys = argKeys;
this.Name = Common.StringIntern(name);
this.Values = values.ToArray();
this.ArgKeys = argKeys.ToArray();
}
}
}
30 changes: 13 additions & 17 deletions PerfettoCds/Pipeline/DataOutput/PerfettoGenericEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.Performance.SDK;
using PerfettoProcessor;
using System.Collections.Generic;
using Utilities;

namespace PerfettoCds.Pipeline.DataOutput
{
Expand All @@ -20,12 +21,9 @@ public readonly struct PerfettoGenericEvent
public Timestamp EndTimestamp { get; }
public string Category { get; }

// Key between slice and args table
public long ArgSetId { get; }

// From Args table. The debug annotations for an event. Variable number per event
public List<string> Values { get; }
public List<string> ArgKeys { get; }
public string[] Values { get; }
public string[] ArgKeys { get; }

// From Process table
public string Process { get; }
Expand All @@ -35,7 +33,7 @@ public readonly struct PerfettoGenericEvent

public string Provider { get; }

public long? ParentId{ get; }
public int? ParentId{ get; }

public int ParentTreeDepthLevel { get; }

Expand All @@ -49,29 +47,27 @@ public PerfettoGenericEvent(string eventName,
Timestamp startTimestamp,
Timestamp endTimestamp,
string category,
long argSetId,
List<string> values,
List<string> argKeys,
string process,
string thread,
string provider,
PerfettoThreadTrackEvent threadTrack,
long? parentId,
int? parentId,
int parentTreeDepthLevel,
string[] parentEventNameTree)
{
EventName = eventName;
Type = type;
EventName = Common.StringIntern(eventName);
Type = Common.StringIntern(type);
Duration = duration;
StartTimestamp = startTimestamp;
EndTimestamp = endTimestamp;
Category = category;
ArgSetId = argSetId;
Values = values;
ArgKeys = argKeys;
Process = process;
Thread = thread;
Provider = provider;
Category = Common.StringIntern(category);
Values = values.ToArray();
ArgKeys = argKeys.ToArray();
Process = Common.StringIntern(process);
Thread = Common.StringIntern(thread);
Provider = Common.StringIntern(provider);
ThreadTrack = threadTrack;
ParentId = parentId;
ParentTreeDepthLevel = parentTreeDepthLevel;
Expand Down
11 changes: 6 additions & 5 deletions PerfettoCds/Pipeline/DataOutput/PerfettoLogcatEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.
using Microsoft.Performance.SDK;
using System.Collections.Generic;
using Utilities;

namespace PerfettoCds.Pipeline.DataOutput
{
Expand All @@ -25,11 +26,11 @@ public PerfettoLogcatEvent(Timestamp startTimestamp,
string message)
{
this.StartTimestamp = startTimestamp;
this.ProcessName = processName;
this.ThreadName = threadName;
this.Priority = priority;
this.Tag = tag;
this.Message = message;
this.ProcessName = Common.StringIntern(processName);
this.ThreadName = Common.StringIntern(threadName);
this.Priority = Common.StringIntern(priority);
this.Tag = Common.StringIntern(tag);
this.Message = Common.StringIntern(message);
}
}
}
6 changes: 3 additions & 3 deletions PerfettoCds/Pipeline/Tables/PerfettoCpuCountersTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class PerfettoCpuCountersTable
{
public static TableDescriptor TableDescriptor => new TableDescriptor(
Guid.Parse("{cc2db5d6-5abb-4094-b8c0-475a2f4d9946}"),
"Perfetto CPU Counters (coarse)",
"CPU Counters (coarse)",
"Displays coarse CPU usage based on /proc/stat counters",
"Perfetto - System",
requiredDataCookers: new List<DataCookerPath> { PerfettoPluginConstants.CpuCountersEventCookerPath }
Expand Down Expand Up @@ -123,7 +123,7 @@ public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieva
tableGenerator.AddColumn(CountColumn, Projection.Constant<int>(1));

// Only display the total CPU usage column
var cpuUsageConfig = new TableConfiguration("Perfetto CPU Usage")
var cpuUsageConfig = new TableConfiguration("CPU Usage %")
{
Columns = new[]
{
Expand All @@ -150,7 +150,7 @@ public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieva
cpuUsageConfig.AddColumnRole(ColumnRole.Duration, DurationColumn);

// Display all CPU counter columns
var allCountersConfig = new TableConfiguration("Perfetto CPU Counters - All")
var allCountersConfig = new TableConfiguration("CPU Counters - All")
{
Columns = new[]
{
Expand Down
4 changes: 2 additions & 2 deletions PerfettoCds/Pipeline/Tables/PerfettoCpuFrequencyTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class PerfettoCpuFrequencyTable
{
public static TableDescriptor TableDescriptor => new TableDescriptor(
Guid.Parse("{5b9689d4-617c-484c-9b0a-c7242565ec13}"),
"Perfetto CPU Frequency Scaling",
"CPU Frequency Scaling",
"Displays CPU frequency scaling events and idle states for CPUs. Idle CPUs show a frequency of 0.",
"Perfetto - System",
requiredDataCookers: new List<DataCookerPath> { PerfettoPluginConstants.CpuFrequencyEventCookerPath }
Expand Down Expand Up @@ -82,7 +82,7 @@ public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieva
tableGenerator.AddColumn(IsIdleColumn, baseProjection.Compose(x => x.IsIdle));

// We are graphing CPU frequency + duration with MAX accumulation, which gives a steady line graph of the current CPU frequency
var tableConfig = new TableConfiguration("Perfetto CPU Frequency")
var tableConfig = new TableConfiguration("CPU Frequency")
{
Columns = allColumns,
Layout = TableLayoutStyle.GraphAndTable,
Expand Down
Loading