diff --git a/Program.cs b/Program.cs index 269b173..7635722 100644 --- a/Program.cs +++ b/Program.cs @@ -1,4 +1,5 @@  +using System.Diagnostics; using System.Reflection; using AdventOfCode.Days; using Spectre.Console; @@ -13,23 +14,35 @@ var select = new SelectionPrompt() var selectedDay = AnsiConsole.Prompt(select); +var stopWatch = new Stopwatch(); + AnsiConsole.MarkupLine($"[cyan]Running [yellow]{selectedDay}[/]...[/]\n"); AnsiConsole.MarkupLine("[cyan]Part [yellow]1[/] result:[/]"); try { + stopWatch.Start(); selectedDay.RunPart1(); + stopWatch.Stop(); + + AnsiConsole.MarkupLine($"[red]Approximate run time: [yellow]{stopWatch.ElapsedTicks / (double)Stopwatch.Frequency * 1000:F3} ms[/][/]"); } catch (Exception e) { AnsiConsole.WriteException(e); } +stopWatch.Reset(); + AnsiConsole.MarkupLine("\n[cyan]Part [yellow]2[/] result:[/]"); try { + stopWatch.Start(); selectedDay.RunPart2(); + stopWatch.Stop(); + + AnsiConsole.MarkupLine($"[red]Approximate run time: [yellow]{stopWatch.ElapsedTicks / (double)Stopwatch.Frequency * 1000:F3} ms[/][/]"); } catch (Exception e) {