I have an GUI application that takes a while to load all its plugins, before it is ready to be used by the user.
I want to write a C# program that would measure the time taken for this application to start up. I thought the Process.WaitForInputIdle() method would do the trick, but it doesn't. It exits as soon as the process is started.
What I have now is this:
DateTime startTime = DateTime.Now;
Process myAppUnderTest = Process.Start("C:\\Program Files\\My App\app_under_test.ext");
myAppUnderTest.WaitForInputIdle(); //Wait until the application is idle.
DateTime endTime = DateTime.Now;
int elapsedTimeInSecs = endTime.Subtract(startTime).Seconds;
Console.WriteLine("Start up time (sec): {0}", elapsedTimeInSecs);
How can I get the start up time that I intend?