calculate memory consumption and cpu usage

This is a discussion on calculate memory consumption and cpu usage within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by cyberfish Ah I see. Thanks for the information. So I guess there is no way to get ...

  1. #16
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by cyberfish View Post
    Ah I see. Thanks for the information.

    So I guess there is no way to get precise AND accurate wall time on Windows?

    Out of curiosity, what is the accuracy (not precision) of gettimeofday() of typical Linux implementations?
    Depends on the implementation, but most systems provide nanosecond accuracy using for example RDTSC - of course, that is still subjec to the problems described elsewhere which is that it CAN vary between CPU's. There are various things done in the system to keep them in sync, but there is still some chance that two or more processors run out of sync, thus leading to minor differences in timing.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #17
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,145
    Does it mean the accuracy is about 1ns, but in 2 consecutive calls to gettimeofday(), the second one may return a time earlier than that returned by the first call?

  3. #18
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Quote Originally Posted by matsp View Post
    Again, although it appears to be VERY PRECISE, it is actually just a different format around "GetTickCount()" - it is updated on each timer tick (10ms), but it returns a 100ns precise time.
    the timer tick resolution on a win system can be increased by call to timeBegin(End)Period

    http://msdn.microsoft.com/en-us/libr...13(VS.85).aspx

    high precision timing in XP on multicore is a big issue (google will give a ton of references). If there is one argument for windows vista regarding multimedia applications/simulations/games and so one than it is it's support for timing via cpu independent HPET chips.

  4. #19
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by pheres View Post
    high precision timing in XP on multicore is a big issue (google will give a ton of references). If there is one argument for windows vista regarding multimedia applications/simulations/games and so one than it is it's support for timing via cpu independent HPET chips.
    And of course, on really modern processors, the TSC is constant and synchronized across cores and sockets, so there's not the same need to worry about it. But for older processors, the HPET is a good way to get it. But there's been problems with HPET on some models of chipsets too, unfortunately.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Page 2 of 2 FirstFirst 12
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