Thread: Execution Question

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    60

    Execution Question

    Hi,
    I have written some code to test the efficiency of some algorithms in real world.
    Now, i think it would be better to disable the cpu interrupts but i wonder how to do it.
    Does it have something to do with the compilation ( through compiler arguments )
    or is it something that i should ask for the OS to do when executing the application ?

    Any help is appreciated

    PS: I use the mingw compiler

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You're not going to disable the interrupts or any other high priority services on any pre-emptive desktop operating system.

    I recently had to time some code on a desktop machine. My approach was to repeat the test 100's or 1000's of times and plot graphs of the timings. The minimum timings were pretty stable from one run to another, but the maximum times showed like ±100% variability in the results, depending on course on exactly what other things happened to momentarily interrupt the test.

    The "best" you can manage is to up the priority (you need admin to do it IIRC), but beware of running long duration tasks at very high priority, you might upset something.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    36
    You can run your program in realtime which means that it will hog up the CPU. Most interrupts should be disabled. You can set the priority of execution for your program to realtime through the Windows API or the task manager. Be careful, though.
    FrancoisSoft
    FrancoisSoft on the Web
    If you stare at a computer for 5 minutes you might be a nerdneck.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. Execution Time - Rijandael encryption
    By gamer4life687 in forum C++ Programming
    Replies: 5
    Last Post: 09-20-2008, 09:25 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM