Skip to content

Commit

Permalink
Fix dotnet-pgo (#77259)
Browse files Browse the repository at this point in the history
* Fix dotnet-pgo dump

* Fix merge compare-mibc and create-mibc too

* A couple more fixes
  • Loading branch information
jakobbotsch authored Oct 20, 2022
1 parent e542a20 commit be7d6f5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/tools/dotnet-pgo/MethodMemoryMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public MethodMemoryMap(
TraceTypeSystemContext tsc,
TraceRuntimeDescToTypeSystemDesc idParser,
int clrInstanceID,
FileInfo preciseDebugInfoFile,
string preciseDebugInfoFile,
Logger logger)
{
// Capture the addresses of jitted code
Expand Down Expand Up @@ -164,7 +164,7 @@ public MethodMemoryMap(
if (preciseDebugInfoFile != null)
{
preciseInfos =
File.ReadAllLines(preciseDebugInfoFile.FullName)
File.ReadAllLines(preciseDebugInfoFile)
.Select(l => JsonSerializer.Deserialize<PreciseDebugInfo>(l))
.ToList();
}
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/tools/dotnet-pgo/PgoRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ public PgoRootCommand(string[] args) : base(".NET PGO Tool")
OutputFilePath,
};

dumpCommand.SetHandler(context => TryExecuteWithContext(context, true));
dumpCommand.SetHandler(context =>
{
DumpMibc = true;
TryExecuteWithContext(context, true);
});

AddCommand(dumpCommand);

Expand All @@ -229,11 +233,7 @@ public PgoRootCommand(string[] args) : base(".NET PGO Tool")
DumpWorstOverlapGraphsTo
};

compareMbicCommand.SetHandler(context =>
{
DumpMibc = true;
TryExecuteWithContext(context, false);
});
compareMbicCommand.SetHandler(context => TryExecuteWithContext(context, false));

AddCommand(compareMbicCommand);

Expand Down
20 changes: 11 additions & 9 deletions src/coreclr/tools/dotnet-pgo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ public int Run()
{
return InnerDumpMain();
}
if (_inputFilesToMerge != null)
if (_inputFilesToMerge.Count > 0)
{
return InnerMergeMain();
}
if (_inputFilesToCompare != null)
if (_inputFilesToCompare.Length > 0)
{
return InnerCompareMibcMain();
}
Expand Down Expand Up @@ -1026,18 +1026,20 @@ private int InnerProcessTraceFileMain()
{
if (etlFileName.EndsWith(nettraceExtension))
{
etlFileName = Path.ChangeExtension(etlFileName, ".etlx");
PrintError($"Creating ETLX file {etlFileName} from {etlFileName}");
TraceLog.CreateFromEventPipeDataFile(etlFileName, etlFileName);
string etlxFileName = Path.ChangeExtension(etlFileName, ".etlx");
PrintMessage($"Creating ETLX file {etlxFileName} from {etlFileName}");
TraceLog.CreateFromEventPipeDataFile(etlFileName, etlxFileName);
etlFileName = etlxFileName;
}
}

string lttngExtension = ".trace.zip";
if (etlFileName.EndsWith(lttngExtension))
{
etlFileName = Path.ChangeExtension(etlFileName, ".etlx");
PrintError($"Creating ETLX file {etlFileName} from {etlFileName}");
TraceLog.CreateFromLttngTextDataFile(etlFileName, etlFileName);
string etlxFileName = Path.ChangeExtension(etlFileName, ".etlx");
PrintMessage($"Creating ETLX file {etlxFileName} from {etlFileName}");
TraceLog.CreateFromLttngTextDataFile(etlFileName, etlxFileName);
etlFileName = etlxFileName;
}

UnZipIfNecessary(ref etlFileName, _command.BasicProgressMessages ? Console.Out : new StringWriter());
Expand Down Expand Up @@ -1449,7 +1451,7 @@ MethodMemoryMap GetMethodMemMap()
tsc,
idParser,
clrInstanceId,
new FileInfo(Get(_command.PreciseDebugInfoFile)),
Get(_command.PreciseDebugInfoFile),
s_logger);
}

Expand Down

0 comments on commit be7d6f5

Please sign in to comment.