skip to Main Content

Is there a way to find out using programs how much time a Windows program (GUI) like MS Word or Adobe Photoshop took to actually load. I understand loading is a subjective issue. Idea is to find out whether a desktop requires attention or not or whether there is any degradation of performance which a user is facing.

2

Answers


  1. A simple solution I think is this one (powershell):

    $datStartTime = Get-Date
    Start-Process -FilePath "C:Program Files (x86)Microsoft OfficeOffice12WINWORD.EXE" -Wait
    $datEndTime = Get-Date
    ($datEndTime-$datStartTime).TotalSeconds
    

    Set the path to the application. Powershell starts the application. Close the application when loaded.
    Then you see the time the application needs to open / close.

    Login or Signup to reply.
  2. The usual Powershell way to time a command or any scriptblock is Measure-Command, for example :

    Measure-Command { Start-Process -FilePath "C:Program FilesMicrosoft OfficeOffice14WINWORD.EXE" }
    

    But this will time only the time Powershell took to spin up the new process, not really the time taken by the application to load a new window and all its interface.

    Fortunately, the System.Diagnostics.Process object which is output by Start-Process has a property called Responding.
    According to this MSDN page , this property tells us if the user interface of the associated process is responding to the system.

    So we can do this little script :

    $StartTime = Get-Date
    $WordProcess = Start-Process -FilePath "C:Program FilesMicrosoft OfficeOffice14WINWORD.EXE" -PassThru
    DO
    {
    Start-Sleep -Milliseconds 1 
    } Until ( $WordProcess.Responding -eq $True )
    $EndTime = Get-Date
    ($EndTime - $StartTime).TotalSeconds
    

    The -PassThru allows the command to return a Process object which we store in $WordProcess.
    Then , we use the Responding property of this object to check if its user interface is responding.

    The DO…Until loop will stop looping as soon as the process is responding.

    “Start-Sleep -Milliseconds 1” will give us a precision of one millisecond, which should be good enough for most purposes.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search