diff --git a/QOIDecoder/DecoderProgram.cs b/QOIDecoder/DecoderProgram.cs index 3940ab5..c617c56 100644 --- a/QOIDecoder/DecoderProgram.cs +++ b/QOIDecoder/DecoderProgram.cs @@ -11,9 +11,13 @@ namespace QOIDecoder class DecoderProgram { static bool verbose = false; + static DateTime t1; static void Main(string[] args) { + AppDomain.CurrentDomain.ProcessExit += ProcessExitMethod; + t1 = DateTime.UtcNow; + if (args.Length == 0) { PrintUsage(); @@ -211,6 +215,13 @@ static void Main(string[] args) static void Verbose(string str) { if (verbose) Console.WriteLine(str); } + static void ProcessExitMethod(object sender, EventArgs args) + { + DateTime t2 = DateTime.UtcNow; + TimeSpan time = t2 - t1; + Console.WriteLine($"Finished in {time.TotalMilliseconds} ms."); + } + static void PrintUsage() { Console.WriteLine("Usage: qoidecode [options] \nOptions:\n-h Print usage and exit.\n-v Verbose logging."); diff --git a/QOIEncoder/EncoderProgram.cs b/QOIEncoder/EncoderProgram.cs index f04a3b1..ccccd1d 100644 --- a/QOIEncoder/EncoderProgram.cs +++ b/QOIEncoder/EncoderProgram.cs @@ -12,9 +12,13 @@ namespace QOIEncoder class EncoderProgram { static bool verbose = false; + static DateTime t1; static void Main(string[] args) { + AppDomain.CurrentDomain.ProcessExit += ProcessExitMethod; + t1 = DateTime.UtcNow; + if (args.Length == 0) { PrintUsage(); @@ -197,6 +201,13 @@ static void Main(string[] args) static void Verbose(string str) { if (verbose) Console.WriteLine(str); } + static void ProcessExitMethod(object sender, EventArgs args) + { + DateTime t2 = DateTime.UtcNow; + TimeSpan time = t2 - t1; + Console.WriteLine($"Finished in {time.TotalMilliseconds} ms."); + } + static void PrintUsage() { Console.WriteLine("Usage: qoiencode [options] \nOptions:\n-h Print usage and exit.\n-v Verbose logging.");