Aggiunta calcolo tempi esecuzione

This commit is contained in:
Samuele E. Locatelli
2022-12-16 20:19:32 +01:00
parent 3a0880e5a4
commit 48fcce3c9b
+19 -3
View File
@@ -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();