Refactor profile collection orchestration and tighten pre-PR checks - #53
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors ProfileTool’s trace/heap collection orchestration into smaller dedicated components, and extracts compiler-generated symbol formatting into a focused formatter to slim down NameFormatter, with regression tests added for provider/path generation.
Changes:
- Introduced
ProfileCollectionServices,DotnetTraceCollector,HeapSnapshotCollector,DotnetTraceProviderFactory, andProfileArtifactPathBuilderto split responsibilities out ofProfileCollectionRunner. - Extracted compiler-generated/state-machine/lambda parsing into
CompilerGeneratedNameFormatterand updatedNameFormatterto delegate to it. - Added tests covering artifact path formatting and ETW provider string generation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Asynkron.Profiler.Tests/ProfileArtifactPathBuilderTests.cs | Adds regression test for timestamped artifact path formatting. |
| tests/Asynkron.Profiler.Tests/DotnetTraceProviderFactoryTests.cs | Adds regression tests for trace provider string generation. |
| src/ProfileTool/Rendering/NameFormatter.cs | Delegates compiler-generated name formatting to extracted formatter. |
| src/ProfileTool/ProfileCollectionServices.cs | New shared services container for collection orchestration (theme, process runner, output, logging). |
| src/ProfileTool/ProfileCollectionRunner.cs | Refactors runner to use new collectors/factories and reduces inline orchestration logic. |
| src/ProfileTool/ProfileArtifactPathBuilder.cs | Centralizes timestamped artifact path building. |
| src/ProfileTool/HeapSnapshotCollector.cs | New heap snapshot collection wrapper around dotnet-gcdump. |
| src/ProfileTool/DotnetTraceProviderFactory.cs | New factory for building dotnet-trace provider strings. |
| src/ProfileTool/DotnetTraceCollector.cs | New trace collector wrapper around dotnet-trace collect. |
| src/ProfilerCore/Rendering/CompilerGeneratedNameFormatter.cs | New formatter for compiler-generated/state-machine/lambda symbol names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using Spectre.Console; |
There was a problem hiding this comment.
using Spectre.Console; is unused in this file. With -warnaserror this will fail the build (CS8019). Remove the unused using (or reference a Spectre type if it’s actually needed).
| using Spectre.Console; |
| @@ -0,0 +1,69 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
There was a problem hiding this comment.
using System.Collections.Generic; is unused in this file. With -warnaserror this will fail the build (CS8019). Remove the unused using.
| using System.Collections.Generic; |
| using System; | ||
| using System.Collections.Generic; | ||
| using Spectre.Console; | ||
|
|
There was a problem hiding this comment.
using System.Collections.Generic; is unused in this file. With -warnaserror this will fail the build (CS8019). Remove the unused using.
Summary
ProfileCollectionRunnerso low-level trace collection, heap snapshot collection, provider building, artifact path building, and shared collection services now live in dedicated typesCompilerGeneratedNameFormatterto slimNameFormatterquickdupfindingsTesting
/tmp/asynkron-profiler-tools/roslynator fix src/ProfileTool/ProfileTool.csproj/tmp/asynkron-profiler-tools/roslynator fix src/ProfilerCore/Asynkron.Profiler.Core.csproj/tmp/asynkron-profiler-tools/roslynator fix tests/Asynkron.Profiler.Tests/Asynkron.Profiler.Tests.csprojdotnet format Asynkron.Profiler.slndotnet build Asynkron.Profiler.sln -warnaserrordotnet test Asynkron.Profiler.sln -warnaserrorquickdup -path src -ext .cs -select 0..20 -min 2 -exclude '.g.,.generated.'