Skip to content

Commit

Permalink
Show when number of methods differs in base/diff (dotnet#122)
Browse files Browse the repository at this point in the history
When multiple same-named methods exist in different numbers in base and
diff, make it clearer in the output. Also call out methods that are exclusive
to base or diff.

Allow analysis to skip reconciliation; this option is useful when
the larger diffs are all in unique methods and you want to focus in on the
methods that are common.
  • Loading branch information
AndyAyersMS authored Nov 7, 2017
1 parent 87b1191 commit 7402ff8
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions src/jit-analyze/jit-analyze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Config
private int _count = 5;
private string _json;
private string _tsv;
private bool _reconcile = true;
private bool _noreconcile = false;

public Config(string[] args)
{
Expand All @@ -44,6 +44,8 @@ public Config(string[] args)
syntax.DefineOption("w|warn", ref _warn,
"Generate warning output for files/methods that only "
+ "exists in one dataset or the other (only in base or only in diff).");
syntax.DefineOption("noreconcile", ref _noreconcile,
"Do not reconcile unique methods in base/diff");
syntax.DefineOption("json", ref _json,
"Dump analysis data to specified file in JSON format.");
syntax.DefineOption("tsv", ref _tsv,
Expand Down Expand Up @@ -77,7 +79,7 @@ private void validate()
public string JsonFileName { get { return _json; } }
public bool DoGenerateJson { get { return _json != null; } }
public bool DoGenerateTSV { get { return _tsv != null; } }
public bool Reconcile { get { return _reconcile; } }
public bool Reconcile { get { return !_noreconcile; } }
}

public class FileInfo
Expand Down Expand Up @@ -396,7 +398,10 @@ public static int Summarize(IEnumerable<FileDelta> fileDeltaList, Config config)
path = fd.path,
name = md.name,
deltaBytes = md.deltaBytes,
count = md.baseOffsets != null ? md.baseOffsets.Count() : 1
baseBytes = md.baseBytes,
diffBytes = md.diffBytes,
baseCount = md.baseOffsets == null ? 0 : md.baseOffsets.Count(),
diffCount = md.diffOffsets == null ? 0 : md.diffOffsets.Count()
}).ToList();
var sortedMethodImprovements = methodDeltaList
.Where(x => x.deltaBytes < 0)
Expand All @@ -416,10 +421,19 @@ public static int Summarize(IEnumerable<FileDelta> fileDeltaList, Config config)
foreach (var method in sortedMethodRegressions.GetRange(0, Math.Min(methodRegressionCount, requestedCount)))
{
Console.Write(" {2,8} : {0} - {1}", method.path, method.name, method.deltaBytes);
if (method.count > 1)

if (method.baseCount == method.diffCount)
{
if (method.baseCount > 1)
{
Console.Write(" ({0} methods)", method.baseCount);
}
}
else
{
Console.Write(" ({0} methods)", method.count);
Console.Write(" ({0}/{1} methods)", method.baseCount, method.diffCount);
}

Console.WriteLine();
}
}
Expand All @@ -431,10 +445,19 @@ public static int Summarize(IEnumerable<FileDelta> fileDeltaList, Config config)
foreach (var method in sortedMethodImprovements.GetRange(0, Math.Min(methodImprovementCount, requestedCount)))
{
Console.Write(" {2,8} : {0} - {1}", method.path, method.name, method.deltaBytes);
if (method.count > 1)

if (method.baseCount == method.diffCount)
{
if (method.baseCount > 1)
{
Console.Write(" ({0} methods)", method.baseCount);
}
}
else
{
Console.Write(" ({0} methods)", method.count);
Console.Write(" ({0}/{1} methods)", method.baseCount, method.diffCount);
}

Console.WriteLine();
}
}
Expand Down

0 comments on commit 7402ff8

Please sign in to comment.