Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for collecting CLR event through EventPipe #1291

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# Rider
.idea

# Private files
OSExtentions.cs

Expand Down
7 changes: 5 additions & 2 deletions src/LinuxEvent.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Runtime.InteropServices;
using Xunit;

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c42873f2-d4a5-4ac7-9adb-9cd8e1856a9b")]

[assembly: CollectionBehavior(DisableTestParallelization = true)]
48 changes: 37 additions & 11 deletions src/PerfView/PerfViewData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8788,19 +8788,45 @@ public TraceLog GetTraceLog(TextWriter log)
log.WriteLine("Creating ETLX file {0} from {1}", etlxFile, dataFileName);
try
{
TraceLog.CreateFromLttngTextDataFile(dataFileName, etlxFile, options);
}
catch (Exception e) // Throws this if there is no CTF Information
{
if (e is EndOfStreamException)
{
log.WriteLine("Warning: Trying to open CTF stream failed, no CTF (lttng) information");
}
else
// linux files could contain CLR events collected either via LTTng or dotnet-trace
using (var zip = ZipFile.Open(dataFileName, ZipArchiveMode.Read))
{
log.WriteLine("Error: Exception CTF conversion: {0}", e.ToString());
log.WriteLine("[Error: exception while opening CTF (lttng) data.]");
var nettraceFile = zip.Entries.FirstOrDefault(e => e.Name.EndsWith(".nettrace"));
if (nettraceFile != null)
{
// look for dotnet-trace recording
var nettraceFilePath = etlxFile + ".nettrace";
nettraceFile.ExtractToFile(nettraceFilePath);
TraceLog.CreateFromEventPipeDataFile(nettraceFilePath, etlxFile, options);
File.Delete(nettraceFilePath);
}
else
{
// look for LTTng recording
try
{
TraceLog.CreateFromLttngTextDataFile(dataFileName, etlxFile, options);
}
catch (Exception e) // Throws this if there is no CTF Information
{
if (e is EndOfStreamException)
{
log.WriteLine("Warning: Trying to open CTF stream failed, no CTF (lttng) information");
}
else
{
log.WriteLine("Error: Exception CTF conversion: {0}", e.ToString());
log.WriteLine("[Error: exception while opening CTF (lttng) data.]");
}

throw;
}
}
}
}
catch (Exception e)
{
log.WriteLine("Error: Exception while opening linux file '{0}'\r\n {1}", e.ToString(), dataFileName);

Debug.Assert(m_traceLog == null);
m_noTraceLogInfo = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Runtime.InteropServices;
using Xunit;

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e89fd36b-c900-4281-b549-3ce0bd580c78")]

[assembly: CollectionBehavior(DisableTestParallelization = true)]
7 changes: 6 additions & 1 deletion src/TraceEvent/TraceEvent.Tests/Platform/EtlTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ private static void UnzipDataFiles()
var dir = Path.Combine(UnZippedDataDir, Path.GetFileNameWithoutExtension(folderZip));
if (!Directory.Exists(dir) || Directory.GetLastWriteTimeUtc(dir) < File.GetLastWriteTimeUtc(folderZip))
{
if (Directory.Exists(dir))
{
Directory.Delete(dir, true);
}

zipFile.ExtractToDirectory(UnZippedDataDir);
}
else
Expand All @@ -90,7 +95,7 @@ protected void PrepareTestData()
Assert.True(Directory.Exists(OriginalBaselineDir));
OriginalBaselineDir = Path.GetFullPath(OriginalBaselineDir);

// This is all atomic because this method is synchronized.
// This is all atomic because this method is synchronized.
Assert.True(Directory.Exists(TestDataDir));
UnzipDataFiles();
if (Directory.Exists(OutputDir))
Expand Down
7 changes: 5 additions & 2 deletions src/TraceEvent/TraceEvent.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Runtime.InteropServices;
using Xunit;

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("19281902-fbc4-48c0-962b-9fdadaf5c783")]

[assembly: CollectionBehavior(DisableTestParallelization = true)]
Loading