Skip to content

Commit

Permalink
An empty profiler report, which just a header, is possible
Browse files Browse the repository at this point in the history
  • Loading branch information
smera committed Dec 5, 2017
1 parent 25a7c09 commit ffb51d8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Build/Evaluation/Profiler/ProfilerResultPrettyPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@ public sealed class ProfilerResultPrettyPrinter
/// </summary>
public static string GetMarkdownContent(ProfilerResult result)
{
var stringBuilder = new StringBuilder();

stringBuilder.AppendLine("Pass|File|Line #|Expression|Inc (ms)|Inc (%)|Exc (ms)|Exc (%)|#|Bug");
stringBuilder.AppendLine("---|---|---:|---|---:|---:|---:|---:|---:|---");

var profiledLocations = result.ProfiledLocations;

// If there are no profiled locations, then just return
if (profiledLocations.Count == 0)
{
return stringBuilder.ToString();
}

var evaluationPasses = profiledLocations.Where(l => l.Key.File == null)
.OrderBy(l => l.Key.EvaluationPass);

var orderedLocations = profiledLocations.Where(l => l.Key.File != null)
.OrderByDescending(l => l.Value.ExclusiveTime);

var stringBuilder = new StringBuilder();

stringBuilder.AppendLine("Pass|File|Line #|Expression|Inc (ms)|Inc (%)|Exc (ms)|Exc (%)|#|Bug");
stringBuilder.AppendLine("---|---|---:|---|---:|---:|---:|---:|---:|---");

TimeSpan? totalTime = null;
foreach (var pair in evaluationPasses)
{
Expand Down

0 comments on commit ffb51d8

Please sign in to comment.