From 48fcce3c9be8a4bed36a68d8bb35fb8df1db6e11 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 16 Dec 2022 20:19:32 +0100 Subject: [PATCH] Aggiunta calcolo tempi esecuzione --- EgwCApp/EgwCApp.Testing/Program.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/EgwCApp/EgwCApp.Testing/Program.cs b/EgwCApp/EgwCApp.Testing/Program.cs index b5e3c66c..de1f7f34 100644 --- a/EgwCApp/EgwCApp.Testing/Program.cs +++ b/EgwCApp/EgwCApp.Testing/Program.cs @@ -12,6 +12,10 @@ Console.WriteLine("calling ext app with args[]:"); string appPath = "./Utils/ExImp.exe"; string procArg = @"C:\Temp\test.log"; Console.WriteLine($"{appPath} {procArg}"); +Console.WriteLine(); +Console.WriteLine("press enter to proceed..."); + +Console.ReadLine(); ProcessStartInfo psi = new ProcessStartInfo { @@ -25,7 +29,9 @@ ProcessStartInfo psi = new ProcessStartInfo RedirectStandardInput = true, }; -//childProc.StartInfo = psi; +Stopwatch sw = new Stopwatch(); +sw.Start(); + Process p = Process.Start(psi); string q = ""; @@ -34,9 +40,19 @@ while (!p.HasExited) q += p.StandardOutput.ReadToEnd(); } -Console.WriteLine("Ext prog ended"); +sw.Stop(); +var timeElaps = sw.Elapsed; +Console.WriteLine($"Ext prog executed in {timeElaps.TotalMilliseconds} ms"); +Console.WriteLine(separator); +Console.WriteLine("press enter to proceed..."); + +Console.ReadLine(); +sw.Restart(); Console.WriteLine("Data received:"); -Console.WriteLine(); Console.WriteLine(q); +Console.WriteLine(); +sw.Stop(); +timeElaps = sw.Elapsed; +Console.WriteLine($"Display executed in {timeElaps.TotalMilliseconds} ms"); Console.ReadLine(); \ No newline at end of file