Repository navigation
Conversation
This is useful for investigating ILC issues on linux.
There was a problem hiding this comment.
Pull request overview
This PR documents how to capture ILC dependency graph data using EventSource on Linux as an alternative to DGML file generation. This is particularly useful for investigating ILCompiler issues on Linux where additional tooling may be needed to process the trace files.
- Adds new section "Dependency Graph EventSource" with complete instructions for capture workflow
- Documents the event schema including Graph, Node, Edge, and ConditionalEdge events
- Provides step-by-step guidance on using
dotnet-traceto collect dependency graph events
|
|
||
| | Field | Type | Description | | ||
| |-------|------|-------------| | ||
| | `id` | long | Unique graph identifier (allows multiple graphs in one trace) | |
There was a problem hiding this comment.
The documented type for the id and name fields appears inconsistent with the EventSource definition. According to EventSourceLogStrategy.cs, the Graph event is defined as Graph(int id, string name), not using long. Consider verifying whether the type should be documented as int or if there's a reason for the type promotion to long in the trace format.
| | `id` | long | Unique graph identifier (allows multiple graphs in one trace) | | |
| | `id` | int | Unique graph identifier (allows multiple graphs in one trace) | |
| | `id` | long | Identifier of the graph this node belongs to | | ||
| | `index` | long | Unique node identifier within the graph | |
There was a problem hiding this comment.
The documented types for the id and index fields appear inconsistent with the EventSource definition. According to EventSourceLogStrategy.cs, the Node event is defined as Node(int id, int index, string name), not using long. Consider verifying whether the type should be documented as int or if there's a reason for the type promotion to long in the trace format.
| | `id` | long | Identifier of the graph this node belongs to | | |
| | `index` | long | Unique node identifier within the graph | | |
| | `id` | int | Identifier of the graph this node belongs to | | |
| | `index` | int | Unique node identifier within the graph | |
| | Field | Type | Description | | ||
| |-------|------|-------------| | ||
| | `id` | long | Identifier of the graph this edge belongs to | | ||
| | `dependentIndex` | long | Source node (the one that depends on the target) | | ||
| | `dependencyIndex` | long | Target node (the dependency) | | ||
| | `reason` | string | Edge label describing why the dependency exists | |
There was a problem hiding this comment.
The documented types for the id, dependentIndex, and dependencyIndex fields appear inconsistent with the EventSource definition. According to EventSourceLogStrategy.cs, the Edge event is defined as Edge(int id, int dependentIndex, int dependencyIndex, string reason), not using long. Consider verifying whether the type should be documented as int or if there's a reason for the type promotion to long in the trace format.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| | `id` | long | Identifier of the graph this conditional edge belongs to | | ||
| | `dependencyIndex` | long | The dependency node | | ||
| | `dependentIndex1` | long | First dependent node | | ||
| | `dependentIndex2` | long | Second dependent node | |
There was a problem hiding this comment.
The documented types for the id, dependencyIndex, dependentIndex1, and dependentIndex2 fields appear inconsistent with the EventSource definition. According to EventSourceLogStrategy.cs, the ConditionalEdge event is defined as ConditionalEdge(int id, int dependentIndex1, int dependentIndex2, int dependencyIndex, string reason), not using long. Consider verifying whether the type should be documented as int or if there's a reason for the type promotion to long in the trace format.
| | `id` | long | Identifier of the graph this conditional edge belongs to | | |
| | `dependencyIndex` | long | The dependency node | | |
| | `dependentIndex1` | long | First dependent node | | |
| | `dependentIndex2` | long | Second dependent node | | |
| | `id` | int | Identifier of the graph this conditional edge belongs to | | |
| | `dependencyIndex` | int | The dependency node | | |
| | `dependentIndex1` | int | First dependent node | | |
| | `dependentIndex2` | int | Second dependent node | |
| | `dependencyIndex` | long | The dependency node | | ||
| | `dependentIndex1` | long | First dependent node | | ||
| | `dependentIndex2` | long | Second dependent node | |
There was a problem hiding this comment.
The field order in the ConditionalEdge event documentation is incorrect. According to the EventSource definition in EventSourceLogStrategy.cs, the event signature is ConditionalEdge(int id, int dependentIndex1, int dependentIndex2, int dependencyIndex, string reason), so the fields should be ordered as:
iddependentIndex1(notdependencyIndex)dependentIndex2(notdependentIndex1)dependencyIndex(notdependentIndex2)reason
The current documentation has dependencyIndex listed second, but it's actually the fourth parameter.
| | `dependencyIndex` | long | The dependency node | | |
| | `dependentIndex1` | long | First dependent node | | |
| | `dependentIndex2` | long | Second dependent node | | |
| | `dependentIndex1` | long | First dependent node | | |
| | `dependentIndex2` | long | Second dependent node | | |
| | `dependencyIndex` | long | The dependency node | |
|
|
||
| ## Dependency graph EventSource | ||
|
|
||
| ILCompiler publishes its dependency graph through the `Microsoft-ILCompiler-DependencyGraph` EventSource. You can capture those events with `dotnet-trace`. The resulting `*.nettrace` file can be processed with the TraceEvent library. This can be useful for investigating ILCompiler issues on linux, but note that it requires additional tooling to process the trace into a DGML file that can be used with the dependency graph viewer. |
There was a problem hiding this comment.
The term "linux" should be capitalized as "Linux" when referring to the operating system.
| ILCompiler publishes its dependency graph through the `Microsoft-ILCompiler-DependencyGraph` EventSource. You can capture those events with `dotnet-trace`. The resulting `*.nettrace` file can be processed with the TraceEvent library. This can be useful for investigating ILCompiler issues on linux, but note that it requires additional tooling to process the trace into a DGML file that can be used with the dependency graph viewer. | |
| ILCompiler publishes its dependency graph through the `Microsoft-ILCompiler-DependencyGraph` EventSource. You can capture those events with `dotnet-trace`. The resulting `*.nettrace` file can be processed with the TraceEvent library. This can be useful for investigating ILCompiler issues on Linux, but note that it requires additional tooling to process the trace into a DGML file that can be used with the dependency graph viewer. |
| | Field | Type | Description | | ||
| |-------|------|-------------| | ||
| | `id` | long | Identifier of the graph this node belongs to | | ||
| | `index` | long | Unique node identifier within the graph | |
There was a problem hiding this comment.
@copilot the events look like this:
// Notice that the bodies of the events follow a pattern: WriteEvent(ID, <args>) where
// ID is a unique ID starting at 1 and incrementing for each new event method. and
// <args> is every argument for the method.
// WriteEvent then takes care of all the details of actually writing out the values complete
// with the name of the event (method name) as well as the names and types of all the parameters.
[Event(1, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Graph(int id, string name) { WriteEvent(1, id, name); }
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(2, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Node(int id, int index, string name) { WriteEvent(2, id, index, name); }
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(3, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Edge(int id, int dependentIndex, int dependencyIndex, string reason) { WriteEvent(3, id, dependentIndex, dependencyIndex, reason); }
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(4, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void ConditionalEdge(int id, int dependentIndex1, int dependentIndex2, int dependencyIndex, string reason) { WriteEvent(4, id, dependentIndex1, dependentIndex2, dependencyIndex, reason); }Please fix the node types (int not long)
This is useful for investigating ILC issues on linux.