Skip to content

Commit 2cf7426

Browse files
committed
Improved document performance output and show slowest files in the summary
1 parent d3062d1 commit 2cf7426

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

StyleCop.Analyzers/StyleCopTester/Program.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ private static async Task MainAsync(string[] args, CancellationToken cancellatio
139139

140140
foreach (var documentId in project.DocumentIds)
141141
{
142+
var document = project.GetDocument(documentId);
142143
var currentDocumentPerformance = await TestDocumentPerformanceAsync(analyzers, project, documentId, force, cancellationToken).ConfigureAwait(false);
143-
Console.WriteLine($"{documentId}: {currentDocumentPerformance.EditsPerSecond:0.00}");
144+
Console.WriteLine($"{document.FilePath ?? document.Name}: {currentDocumentPerformance.EditsPerSecond:0.00}");
144145
documentPerformance.Add(documentId, currentDocumentPerformance);
145146
}
146147

@@ -156,6 +157,18 @@ private static async Task MainAsync(string[] args, CancellationToken cancellatio
156157
}
157158
}
158159

160+
var slowestFiles = documentPerformance.OrderBy(pair => pair.Value.EditsPerSecond).GroupBy(pair => pair.Key.ProjectId);
161+
Console.WriteLine("Slowest files in each project:");
162+
foreach (var projectGroup in slowestFiles)
163+
{
164+
Console.WriteLine($" {solution.GetProject(projectGroup.Key).Name}");
165+
foreach (var pair in projectGroup.Take(5))
166+
{
167+
var document = solution.GetDocument(pair.Key);
168+
Console.WriteLine($" {document.FilePath ?? document.Name}: {pair.Value.EditsPerSecond:0.00}");
169+
}
170+
}
171+
159172
foreach (var projectId in solution.ProjectIds)
160173
{
161174
double averageEditsInProject;

0 commit comments

Comments
 (0)