7

Situation

I have been running a process on my laptop doing some heavy processing for the last few days. Every night I hibernate my computer, and boot it up in the morning.

What I Seek

I'm looking for a way to determine how long this process has been running.

What I've Tried

  • Using PowerShell I was able to find the start time of my process.

    Get-Process | Select-Object id, starttime, name |Sort-Object name
    

    However this is just the start time. I would like to know how long my process has been actively running. Not the time since it began running.

    6/13/2014 9:15:43 AM -> NOW (6/24/2014 10:38:45 AM) = 11 Days 1 Hour 23 Minutes 0 Seconds.

  • Using Task Manager, under the Processes tab I've looked at the CPU Time column, which is useful, and probably give the best statistical number for "how much time it takes to run this program", it however is not how long the process has been running.

    363:47:35

Edit: I don't think I was very clear, that I know how to get the elapsed time since this process began, however that isn't the amount of time the process has been running because I hibernate my computer, which basically freezes it. So I'm roughly looking for elapsed time since beginning process minus time spent hibernating between now and when the process began.

  • Because I'm not up to writing a full blown answer: Perfmon>Process Object>Elapsed Time Counter>Your Process Instance – joeqwerty Jun 24 '14 at 14:57
  • Here too: serverfault.com/a/543130/87017 – Pacerier Dec 26 '16 at 3:34
  • @Pacerier However, this won't account for the amount of time the computer was in hibernation since the process started. – BenVlodgi Dec 27 '16 at 8:02
6

In PowerShell:

PS C:\> New-TimeSpan -Start (get-process notepad).StartTime

Found this command on TechNet Blogs.

  • This worked on my python.exe but not my erl.exe – VenomFangs Oct 16 '15 at 16:19
  • Has to run PowerShell as admin. – Jiahao Cai May 31 at 15:11
0
(Get-Process | ft Name,@{label="Elapsed Time";expression={[System.Math]::Round(((Get-Date)-$_.StartTime).totalseconds)}})
  • 2
    More info would help readers. – harrymc Jun 24 '14 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.