Results 1 to 7 of 7

Thread: Cross platform CPU idle timeout

  1. #1
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Cross platform CPU idle timeout

    Hi All,

    I'm trying to find a way to detect when the CPU has been idle for X minutes that will work cross-platform. It's for http://splish.sf.net - a render manager in case anyone's interested. It's using Qt4.

    Cheers,

    Alan.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cross platform CPU idle timeout

    I guess Heisenberg would say this was impossible

  3. #3
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Cross platform CPU idle timeout

    ahhh ok - thanks Wysota - I was hopeful.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cross platform CPU idle timeout

    The thing is that the act of measurement influences the measurement itself - if you want to test for "idleness" (which is hard to define on its own), you have to do some calculations causes the CPU to become not idle.

    You could try cheating by checking once in a while the load average and assume that if during the last X minutes you didn't notice that it went higher than some predefined threshold, it means the cpu is idle. Or you could do it even simpler - by checking the long term load average and again decide against some threshold.

  5. #5
    Join Date
    Nov 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Cross platform CPU idle timeout

    Quote Originally Posted by wysota View Post
    You could try cheating by checking once in a while the load average and assume that if during the last X minutes you didn't notice that it went higher than some predefined threshold, it means the cpu is idle.
    This sounds ideal for what I'm after. I assume that a crossplatform support for this is also going to require custom code for each platform?

    Cheers,

    Alan.

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cross platform CPU idle timeout

    On win you can use GetSystemTimes( http://msdn.microsoft.com/library/de...ystemtimes.asp)
    This gives you idle time, kernel time and user time. You can poll this function periodically and compute some statistics.

    On Linux and Mac there are similar syscalls (which I can't remember now ).

    regards

  7. #7
    Join Date
    Dec 2010
    Location
    Chennai, India
    Posts
    6
    Thanks
    1
    Qt products
    Qt4 Qt Jambi
    Platforms
    Windows Symbian S60

    Default Re: Cross platform CPU idle timeout

    Msdn link is gr8 but do u think there is ne such work around for a mobile ? (im using qt 4.7)
    Don't let ur hormones hijack your intelligence !
    Joe Winifred

Similar Threads

  1. Cross Platform Logging
    By skyphyr in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2006, 16:32
  2. Cross compile QT/X11 for platform xscale-elf
    By nmkarvekar in forum Installation and Deployment
    Replies: 0
    Last Post: 19th May 2006, 07:20
  3. Using Qt to write Cross Platform Library
    By ball in forum Qt Programming
    Replies: 2
    Last Post: 3rd April 2006, 09:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.