diff --git a/src/tye/Program.DeployCommand.cs b/src/tye/Program.DeployCommand.cs index 769b2954..a525a123 100644 --- a/src/tye/Program.DeployCommand.cs +++ b/src/tye/Program.DeployCommand.cs @@ -59,6 +59,8 @@ namespace Microsoft.Tye private static async Task ExecuteDeployAsync(OutputContext output, ApplicationBuilder application, string environment, bool interactive, bool force) { + var watch = System.Diagnostics.Stopwatch.StartNew(); + if (!await KubectlDetector.Instance.IsKubectlInstalled.Value) { throw new CommandException($"Cannot apply manifests because kubectl is not installed."); @@ -98,6 +100,12 @@ namespace Microsoft.Tye }; await executor.ExecuteAsync(application); + + watch.Stop(); + + TimeSpan elapsedTime = watch.Elapsed; + + output.WriteAlwaysLine($"Time Elapsed: {elapsedTime.Hours:00}:{elapsedTime.Minutes:00}:{elapsedTime.Seconds:00}:{elapsedTime.Milliseconds / 10:00}"); } internal static void ApplyRegistry(OutputContext output, ApplicationBuilder application, bool interactive, bool requireRegistry) diff --git a/src/tye/Program.InitCommand.cs b/src/tye/Program.InitCommand.cs index aa6f117f..0171efac 100644 --- a/src/tye/Program.InitCommand.cs +++ b/src/tye/Program.InitCommand.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.IO; @@ -29,8 +30,16 @@ namespace Microsoft.Tye command.Handler = CommandHandler.Create((console, path, force) => { + var watch = System.Diagnostics.Stopwatch.StartNew(); + var outputFilePath = InitHost.CreateTyeFile(path, force); console.Out.WriteLine($"Created '{outputFilePath}'."); + + watch.Stop(); + + TimeSpan elapsedTime = watch.Elapsed; + + console.Out.WriteLine($"Time Elapsed: {elapsedTime.Hours:00}:{elapsedTime.Minutes:00}:{elapsedTime.Seconds:00}:{elapsedTime.Milliseconds / 10:00}"); }); return command; diff --git a/src/tye/UndeployHost.cs b/src/tye/UndeployHost.cs index 1c1e6901..3240f2c9 100644 --- a/src/tye/UndeployHost.cs +++ b/src/tye/UndeployHost.cs @@ -19,6 +19,8 @@ namespace Microsoft.Tye { public static async Task UndeployAsync(IConsole console, FileInfo path, Verbosity verbosity, string @namespace, bool interactive, bool whatIf) { + var watch = System.Diagnostics.Stopwatch.StartNew(); + var output = new OutputContext(console, verbosity); output.WriteInfoLine("Loading Application Details..."); @@ -31,6 +33,12 @@ namespace Microsoft.Tye } await ExecuteUndeployAsync(output, application, @namespace, interactive, whatIf); + + watch.Stop(); + + TimeSpan elapsedTime = watch.Elapsed; + + output.WriteAlwaysLine($"Time Elapsed: {elapsedTime.Hours:00}:{elapsedTime.Minutes:00}:{elapsedTime.Seconds:00}:{elapsedTime.Milliseconds / 10:00}"); } public static async Task ExecuteUndeployAsync(OutputContext output, ConfigApplication application, string @namespace, bool interactive, bool whatIf) @@ -52,10 +60,10 @@ namespace Microsoft.Tye // - kubectl api-resources --all (and similar) are implemented client-side (n+1 problem) // - the C# k8s SDK doesn't have an untyped api for operations on arbitrary resources, the // closest thing is the custom resource APIs - // - Legacy resources without an api group don't follow the same URL scheme as more modern + // - Legacy resources without an api group don't follow the same URL scheme as more modern // ones, and thus cannot be addressed using the custom resource APIs. // - // So solving 'undeploy' generically would involve doing a bunch of work to query things + // So solving 'undeploy' generically would involve doing a bunch of work to query things // generically, including going outside of what's provided by the SDK. // // - querying api-resources