Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/Tools/dotnet-gcdump/CommandLine/CollectCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal static class CollectCommandHandler
/// <param name="verbose">Enable verbose logging.</param>
/// <param name="name">The process name to collect the gcdump from.</param>
/// <param name="diagnosticPort">The diagnostic IPC channel to collect the gcdump from.</param>
/// <param name="dsrouter">The dsrouter command to use for collecting the gcdump.</param>
/// <returns></returns>
private static async Task<int> Collect(CancellationToken ct, int processId, string output, int timeout, bool verbose, string name, string diagnosticPort, string dsrouter)
{
Expand Down Expand Up @@ -110,6 +111,10 @@ private static async Task<int> Collect(CancellationToken ct, int processId, stri
Console.Error.WriteLine($"[ERROR] {ex}");
return -1;
}
finally
{
DsRouterProcessLauncher.Launcher.Cleanup();
}
}

internal static bool TryCollectMemoryGraph(CancellationToken ct, int processId, string diagnosticPort, int timeout, bool verbose, out MemoryGraph memoryGraph)
Expand Down Expand Up @@ -139,7 +144,8 @@ public static Command CollectCommand()
VerboseOption,
TimeoutOption,
NameOption,
DiagnosticPortOption
DiagnosticPortOption,
DsRouterOption
};

collectCommand.SetAction(static (parseResult, ct) => Collect(ct,
Expand All @@ -149,7 +155,7 @@ public static Command CollectCommand()
verbose: parseResult.GetValue(VerboseOption),
name: parseResult.GetValue(NameOption),
diagnosticPort: parseResult.GetValue(DiagnosticPortOption) ?? string.Empty,
dsrouter: string.Empty));
dsrouter: parseResult.GetValue(DsRouterOption) ?? string.Empty));

return collectCommand;
}
Expand Down Expand Up @@ -191,5 +197,11 @@ public static Command CollectCommand()
{
Description = "The path to a diagnostic port to collect the dump from."
};

private static readonly Option<string> DsRouterOption =
new("--dsrouter")
{
Description = "The dsrouter command to use for collecting the gcdump. If specified, the --process-id, --name, or --diagnostic-port options cannot be used."
};
}
}
Loading