From: Marisa You Date: Wed, 19 Jun 2019 23:48:38 +0000 (-0700) Subject: fixed width of trace recording to be constant (#349) X-Git-Tag: submit/tizen/20190813.035844~4^2^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed1f99cb7e59aed064fa88684471ddfdb33ca19a;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git fixed width of trace recording to be constant (#349) Fixes #316 The trace recording is displayed in the UI as: Recording trace 1.733 (MB) This fix aligns the unit of the trace recording size (MB) so that it does not move left and right when the number of digits changes. --- diff --git a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs index c1ad9c132..fadfa256f 100644 --- a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs +++ b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs @@ -217,13 +217,13 @@ namespace Microsoft.Diagnostics.Tools.Trace private static string GetSize(long length) { if (length > 1e9) - return $"{length / 1e9:0.00##} (GB)"; + return String.Format("{0,-8} (GB)", $"{length / 1e9:0.00##}"); else if (length > 1e6) - return $"{length / 1e6:0.00##} (MB)"; + return String.Format("{0,-8} (MB)", $"{length / 1e6:0.00##}"); else if (length > 1e3) - return $"{length / 1e3:0.00##} (KB)"; + return String.Format("{0,-8} (KB)", $"{length / 1e3:0.00##}"); else - return $"{length / 1.0:0.00##} (byte)"; + return String.Format("{0,-8} (byte)", $"{length / 1.0:0.00##}"); } public static Command CollectCommand() =>