0

I want to calculate the time spent by any process to load at startup?Want the time elapsed from the moment when we double click an application icon until the application completely loads all the dependencies and waits idle. I am only wanting this for those applications which have a window not for console based application or services.

for an initial approach I used windows ETW tracing to trace EVENT_TRACE_FLAG_PROCESS type events. So events pertainig to process create or kill or a running process will be recieved by my consumer. Now I further filter to get only those events related to "EVENT_TRACE_TYPE_START"

Now when a event comes to my callback I can get the pid of the process that is starting. so for instance say I launched OUTLOOK.exe (pid:3946), I will get a event in my callback with pid = 3946. Can somebody tell me with this how can I calculate the time taken for OUTLOOK.exe or any other application to completely load its windows and be ready for user input.

debanka
  • 187
  • 1
  • 4
  • 13
  • You may be looking for `WaitForInputIdle` – Igor Tandetnik Feb 13 '15 at 15:05
  • yeah I did that....actually. something kinda like this CODE: long long start = nanoseconds_now(); if(0==WaitForInputIdle(hProcess, INFINITE)) elapsedTime = nanoseconds_now() - Data->first; – debanka Feb 14 '15 at 07:33
  • DOUBT: I used ETW to trace EVENT_TRACE_FLAG_PROCESS type and took only those processes into account which were getting launched , using the macro EVENT_TRACE_TYPE_START, and I was using WaitForInputIdle to calculate the startup time for processes. But for applications like Outlook , Microsoft Word which on clicking gives out a splash screen and then loads the initial screen WaitForInputIdle was giving the time taken for the splash screen to load, and not the startup time of an application. hence my doubt is there a way to detect if an application during launch pops out a splash screen or not? – debanka Feb 18 '15 at 12:20
  • I don't believe there's a reliable, general way to distinguish a splash screen from a "real" main window. As far as the OS is concerned, the application has just put up a window that is ready to accept user input - it can't know that the window is going to ignore all that input. You could try some heuristics, I suppose (e.g. does this window have any child controls? If not, it's probably a splash screen). – Igor Tandetnik Feb 18 '15 at 14:35
  • Thanks Igor , I did just that .....I did EnumChildWindows , to differentiate a splash screen and the expected main window. Worked perfectly. – debanka Feb 23 '15 at 11:40
  • Now there is another issue- The application should run as a service , but WaitForInputIdle cannot be used from a service application. In that case it always returnsWAIT_FAILED. – debanka Feb 23 '15 at 11:41

0 Answers0