Skip to content

Document ILC dependency graph EventSource collection - #122084

Closed
sbomer wants to merge 1 commit into
dotnet:mainfrom
sbomer:depGraphEvents
Closed

sbomer wants to merge 1 commit into
dotnet:mainfrom
sbomer:depGraphEvents

Conversation

@sbomer

@sbomer sbomer commented Dec 1, 2025

Copy link
Copy Markdown
Member

This is useful for investigating ILC issues on linux.

This is useful for investigating ILC issues on linux.
@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 1, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-trace to collect dependency graph events


| Field | Type | Description |
|-------|------|-------------|
| `id` | long | Unique graph identifier (allows multiple graphs in one trace) |

Copilot AI Dec 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
| `id` | long | Unique graph identifier (allows multiple graphs in one trace) |
| `id` | int | Unique graph identifier (allows multiple graphs in one trace) |

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +102
| `id` | long | Identifier of the graph this node belongs to |
| `index` | long | Unique node identifier within the graph |

Copilot AI Dec 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
| `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 |

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +113
| 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 |

Copilot AI Dec 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment on lines +120 to +123
| `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 |

Copilot AI Dec 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
| `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 |

Copilot uses AI. Check for mistakes.
Comment on lines +121 to +123
| `dependencyIndex` | long | The dependency node |
| `dependentIndex1` | long | First dependent node |
| `dependentIndex2` | long | Second dependent node |

Copilot AI Dec 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. id
  2. dependentIndex1 (not dependencyIndex)
  3. dependentIndex2 (not dependentIndex1)
  4. dependencyIndex (not dependentIndex2)
  5. reason

The current documentation has dependencyIndex listed second, but it's actually the fourth parameter.

Suggested change
| `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 |

Copilot uses AI. Check for mistakes.

## 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.

Copilot AI Dec 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term "linux" should be capitalized as "Linux" when referring to the operating system.

Suggested change
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.

Copilot uses AI. Check for mistakes.
| Field | Type | Description |
|-------|------|-------------|
| `id` | long | Identifier of the graph this node belongs to |
| `index` | long | Unique node identifier within the graph |

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@sbomer sbomer closed this Dec 2, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants