processtimer

This is a discussion on processtimer within the C++ Programming forums, part of the General Programming Boards category; Just a question out of curiousity: Is there a way to messure the total time a process have had since ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    114

    processtimer

    Just a question out of curiousity:

    Is there a way to messure the total time a process have had since it started(Total processing time, total processortime).

    To explain better: if there is four processes running they will share the processor time between them. Lets say that each process gets 1/4 of a second of processor time each second. The lifetime (start to end) of the process would be 1 second * seconds_running. The processtime(start to end) would be 1/4 * seconds_running.

    This above defines processtime. (So we all know what we are talking about here right? )

    Now. If we could get the processtime, this would make better performance checking, since any other operation I did on the computer won't be accounted for. A performance check using a timeGetTime and the pseudo timeGetProcessTime would differ in result. Say I have my movie player running while doing the timeGetTime performance check, the result would totaly suffer! Now with the timeGetProcessTime checker the result will always be accurret, even if I played my movie in check 1 and didn't in check 2!

    I know you can get processtime somehow, because you can see it in the Task Manager->processes->CPUtime.

    Well happy for any answer!

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Well, last time I responded to one of your threads, you simply called me an idiot, so perhaps I should be very careful when I think of suggesting to such a genius that he look at the documentation of the GetProcessTimes() API function and see if what he wants is there.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Echo adrian...

    But (as far as windows goes) its not processes that get CPU time...its their threads of which a process can have more than 1...........

    If you want to do this on a thread by thread basis...lookup the API function GetThreadTimes() and manipulate the returns accordingly..............

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    114
    Ok, thanx mate. I'll look that up! Sorry for calling you an idiot before.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21