Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/Tools/dotnet-counters/CounterMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ public async Task<ReturnCode> Monitor(
_stdError.WriteLine(e.Message);
return ReturnCode.ArgumentError;
}
finally
{
DsRouterProcessLauncher.Launcher.Cleanup();
}
}
public async Task<ReturnCode> Collect(
CancellationToken ct,
Expand Down Expand Up @@ -350,6 +354,10 @@ public async Task<ReturnCode> Collect(
_stdError.WriteLine(e.Message);
return ReturnCode.ArgumentError;
}
finally
{
DsRouterProcessLauncher.Launcher.Cleanup();
}
}

private static void ValidateNonNegative(int value, string argName)
Expand Down
16 changes: 12 additions & 4 deletions src/Tools/dotnet-counters/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ private static Command MonitorCommand()
MaxHistogramOption,
MaxTimeSeriesOption,
DurationOption,
ShowDeltasOption
ShowDeltasOption,
DSRouterOption
};

monitorCommand.TreatUnmatchedTokensAsErrors = false; // see the logic in Main
Expand All @@ -50,7 +51,7 @@ private static Command MonitorCommand()
maxTimeSeries: parseResult.GetValue(MaxTimeSeriesOption),
duration: parseResult.GetValue(DurationOption),
showDeltas: parseResult.GetValue(ShowDeltasOption),
dsrouter: string.Empty
dsrouter: parseResult.GetValue(DSRouterOption)
));

return monitorCommand;
Expand All @@ -72,7 +73,8 @@ private static Command CollectCommand()
ResumeRuntimeOption,
MaxHistogramOption,
MaxTimeSeriesOption,
DurationOption
DurationOption,
DSRouterOption
};

collectCommand.TreatUnmatchedTokensAsErrors = false; // see the logic in Main
Expand All @@ -90,7 +92,7 @@ private static Command CollectCommand()
maxHistograms: parseResult.GetValue(MaxHistogramOption),
maxTimeSeries: parseResult.GetValue(MaxTimeSeriesOption),
duration: parseResult.GetValue(DurationOption),
dsrouter: string.Empty));
dsrouter: parseResult.GetValue(DSRouterOption)));

return collectCommand;
}
Expand Down Expand Up @@ -139,6 +141,12 @@ private static Command CollectCommand()
" To discover well-known provider and counter names, please visit https://learn.microsoft.com/dotnet/core/diagnostics/built-in-metrics."
};

private static readonly Option<string> DSRouterOption =
new("--dsrouter")
{
Description = @"The dsrouter command to start. Value should be one of ios, ios-sim, android, android-emu. Run `dotnet-dsrouter -h` for more information."
};

private static Command ListCommand()
{
Command listCommand = new(
Expand Down