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
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageVersion Include="Azure.Core" Version="1.38.0" />
<PackageVersion Include="Azure.Identity" Version="1.11.4" />
<PackageVersion Include="MicroBuild.Core" Version="0.3.1" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.510501" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.74.1" />
<PackageVersion Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.74.1" />
Expand Down
8 changes: 8 additions & 0 deletions src/PerfView/PerfView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
HeapDump dependencies are pulled from the HeapDump output directory because HeapDump runs out of process
and can have a different set of dependencies.
-->
<PackageReference Include="Microsoft.Bcl.HashCode" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Win32.Registry" GeneratePathProperty="true" />
<PackageReference Include="System.Collections.Immutable" GeneratePathProperty="true" />
<PackageReference Include="System.Reflection.Metadata" GeneratePathProperty="true" />
Expand Down Expand Up @@ -411,6 +412,13 @@
<Link>Microsoft.Diagnostics.FastSerialization.dll</Link>
<Visible>False</Visible>
</EmbeddedResource>
<EmbeddedResource Include="$(PkgMicrosoft_Bcl_HashCode)\lib\netstandard2.0\Microsoft.Bcl.HashCode.dll">
<Type>Non-Resx</Type>
<WithCulture>false</WithCulture>
<LogicalName>.\Microsoft.Bcl.HashCode.dll</LogicalName>
<Link>Microsoft.Bcl.HashCode.dll</Link>
<Visible>False</Visible>
</EmbeddedResource>
<EmbeddedResource Include="$(PkgMicrosoft_Win32_Registry)\lib\net461\Microsoft.Win32.Registry.dll">
<Type>Non-Resx</Type>
<WithCulture>false</WithCulture>
Expand Down
5 changes: 5 additions & 0 deletions src/TraceEvent/EventPipe/EventPipeEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ internal void ReadTraceBlockV6OrGreater(Block block)
{
_expectedCPUSamplingRate = intVal3;
}
else if (key == "SystemPageSize" && ulong.TryParse(value, out ulong ulongVal) && ulongVal > 0)
{
_systemPageSize = ulongVal;
}
}
}

Expand Down Expand Up @@ -656,6 +660,7 @@ private DynamicTraceEventData CreateTemplate(EventPipeMetadata metadata)
private int _lastLabelListId;
internal int _processId;
internal int _expectedCPUSamplingRate;
internal ulong _systemPageSize;
private RewindableStream _stream;
private bool _isStreaming;
private ThreadCache _threadCache;
Expand Down
41 changes: 41 additions & 0 deletions src/TraceEvent/Parsers/UniversalSystemTraceEventParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,10 @@ internal sealed class ELFProcessMappingSymbolMetadata : ProcessMappingSymbolMeta
[JsonPropertyName("build_id")]
public string BuildId { get; set; }
[JsonPropertyName("p_vaddr")]
[JsonConverter(typeof(HexUInt64Converter))]
public ulong VirtualAddress { get; set; }
[JsonPropertyName("p_offset")]
[JsonConverter(typeof(HexUInt64Converter))]
public ulong FileOffset { get; set; }
}

Expand Down Expand Up @@ -535,4 +537,43 @@ public override void Write(Utf8JsonWriter writer, ProcessMappingSymbolMetadata v
JsonSerializer.Serialize(writer, value, value.GetType(), options);
}
}

internal class HexUInt64Converter : JsonConverter<ulong>
{
public override ulong Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.Number)
{
return reader.GetUInt64();
}

if (reader.TokenType != JsonTokenType.String)
{
throw new JsonException($"Cannot convert token of type {reader.TokenType} to ulong.");
}

string text = reader.GetString();
if (text != null && text.StartsWith("0x", StringComparison.OrdinalIgnoreCase) && text.Length > 2)
{
if (ulong.TryParse(text.Substring(2), System.Globalization.NumberStyles.HexNumber,
System.Globalization.CultureInfo.InvariantCulture, out ulong hexValue))
{
return hexValue;
}
}

if (ulong.TryParse(text, System.Globalization.NumberStyles.Integer,
System.Globalization.CultureInfo.InvariantCulture, out ulong value))
{
return value;
}

throw new JsonException($"Cannot convert \"{text}\" to ulong.");
}

public override void Write(Utf8JsonWriter writer, ulong value, JsonSerializerOptions options)
{
writer.WriteStringValue("0x" + value.ToString("X"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ public static void RegisterParsers(TraceLog traceLog)

public void BeforeProcess(TraceLog traceLog, TraceEventDispatcher source)
{
// Extract system page size for ELF RVA calculations.
if (source is EventPipeEventSource eventPipeSource)
{
eventPipeSource.HeadersDeserialized += delegate ()
{
traceLog.systemPageSize = eventPipeSource._systemPageSize;
};
}

UniversalSystemTraceEventParser universalSystemParser = new UniversalSystemTraceEventParser(source);
universalSystemParser.ExistingProcess += delegate (ProcessCreateTraceData data)
{
Expand Down
Loading