+ Reply to Thread
Results 1 to 7 of 7

Limit CPU Usage

  1. #1
    Bill Martin
    Guest

    Limit CPU Usage

    I'm not sure if this is a VBA question, an Excel question, or an XP
    question, but is there a way to limit how much CPU Excel burns?

    I've written a macro that will endlessly run a Monte Carlo solution.
    Normally I run it overnight and all is well. Sometimes however I run it
    during the day, particularly if I'm tinkering with the code and want to run
    it in the background to watch how it performs. When I do this it pegs CPU
    usage at 100% and makes everything else on the machine painfully sluggish.

    Is there some way to cut back on how much CPU Excel consumes? Ideally I'd
    like my VBA routine to periodically sample CPU usage and adjust what Excel
    consumes. Alternatively, is there someway I can manually adjust it?

    Thanks.

    Bill


  2. #2
    Jim Thomlinson
    Guest

    RE: Limit CPU Usage

    I am not 100% sure if this will work for you or not but in the task manager
    you can set the priority of the processes that are running. Open the Task
    manager -> Select the Processes tab -> Right Click on Excel -> Select Set
    Priority and lower the priority from normal to ??? This tells the OS what
    priority to give each program when it requests CPU time. I think that might
    work for you...
    --
    HTH...

    Jim Thomlinson


    "Bill Martin" wrote:

    > I'm not sure if this is a VBA question, an Excel question, or an XP
    > question, but is there a way to limit how much CPU Excel burns?
    >
    > I've written a macro that will endlessly run a Monte Carlo solution.
    > Normally I run it overnight and all is well. Sometimes however I run it
    > during the day, particularly if I'm tinkering with the code and want to run
    > it in the background to watch how it performs. When I do this it pegs CPU
    > usage at 100% and makes everything else on the machine painfully sluggish.
    >
    > Is there some way to cut back on how much CPU Excel consumes? Ideally I'd
    > like my VBA routine to periodically sample CPU usage and adjust what Excel
    > consumes. Alternatively, is there someway I can manually adjust it?
    >
    > Thanks.
    >
    > Bill
    >
    >


  3. #3
    Bill Martin
    Guest

    Re: Limit CPU Usage

    That's a little scary. Before making the change it says:

    "WARNING: Changing the priority class of this process may cause undesired
    results including system instability." <Insert your favorite Microsoft
    reliability joke here>

    Anyhow, the good news is that it does make the rest of the machine become
    responsive if I drop Excel's priority one notch. The bad news is that it
    appears to bring Excel to a full dead stop rather than just throttling it
    back a bit.

    Bill
    --------------------------------
    "Jim Thomlinson" <[email protected]> wrote in message
    news:[email protected]...
    >I am not 100% sure if this will work for you or not but in the task manager
    > you can set the priority of the processes that are running. Open the Task
    > manager -> Select the Processes tab -> Right Click on Excel -> Select Set
    > Priority and lower the priority from normal to ??? This tells the OS what
    > priority to give each program when it requests CPU time. I think that
    > might
    > work for you...
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "Bill Martin" wrote:
    >
    >> I'm not sure if this is a VBA question, an Excel question, or an XP
    >> question, but is there a way to limit how much CPU Excel burns?
    >>
    >> I've written a macro that will endlessly run a Monte Carlo solution.
    >> Normally I run it overnight and all is well. Sometimes however I run it
    >> during the day, particularly if I'm tinkering with the code and want to
    >> run
    >> it in the background to watch how it performs. When I do this it pegs
    >> CPU
    >> usage at 100% and makes everything else on the machine painfully
    >> sluggish.
    >>
    >> Is there some way to cut back on how much CPU Excel consumes? Ideally
    >> I'd
    >> like my VBA routine to periodically sample CPU usage and adjust what
    >> Excel
    >> consumes. Alternatively, is there someway I can manually adjust it?
    >>
    >> Thanks.
    >>
    >> Bill
    >>
    >>



  4. #4
    Vic Eldridge
    Guest

    RE: Limit CPU Usage

    Hi Bill,

    Try calling the DoEvents function throughout your code. If you have a loop
    that's running millions of times, stick a DoEvents inside that loop.

    Regards,
    Vic Eldridge


    "Bill Martin" wrote:

    > I'm not sure if this is a VBA question, an Excel question, or an XP
    > question, but is there a way to limit how much CPU Excel burns?
    >
    > I've written a macro that will endlessly run a Monte Carlo solution.
    > Normally I run it overnight and all is well. Sometimes however I run it
    > during the day, particularly if I'm tinkering with the code and want to run
    > it in the background to watch how it performs. When I do this it pegs CPU
    > usage at 100% and makes everything else on the machine painfully sluggish.
    >
    > Is there some way to cut back on how much CPU Excel consumes? Ideally I'd
    > like my VBA routine to periodically sample CPU usage and adjust what Excel
    > consumes. Alternatively, is there someway I can manually adjust it?
    >
    > Thanks.
    >
    > Bill
    >
    >


  5. #5
    Charles Williams
    Guest

    Re: Limit CPU Usage

    Sounds like a situation where a multi-core system would be ideal: Excel
    versions prior to Excel2007 do single-threaded calculation so you would only
    be using 1 cpu leaving the other free.
    (In Excel 2007 you can control how many calculation threads to use).


    BTW if you are using range.calculate in your montecarlo simulation it runs a
    lot faster in excel versions 97 and 2000 than 2002 /2003.

    regards
    Charles
    ______________________
    Decision Models
    FastExcel 2.2 Beta now available
    www.DecisionModels.com

    "Bill Martin" <[email protected]> wrote in message
    news:%[email protected]...
    > I'm not sure if this is a VBA question, an Excel question, or an XP
    > question, but is there a way to limit how much CPU Excel burns?
    >
    > I've written a macro that will endlessly run a Monte Carlo solution.
    > Normally I run it overnight and all is well. Sometimes however I run it
    > during the day, particularly if I'm tinkering with the code and want to
    > run it in the background to watch how it performs. When I do this it pegs
    > CPU usage at 100% and makes everything else on the machine painfully
    > sluggish.
    >
    > Is there some way to cut back on how much CPU Excel consumes? Ideally I'd
    > like my VBA routine to periodically sample CPU usage and adjust what Excel
    > consumes. Alternatively, is there someway I can manually adjust it?
    >
    > Thanks.
    >
    > Bill




  6. #6
    Bill Martin
    Guest

    Re: Limit CPU Usage

    That has possibilities Vic. I have various levels of nested loops and I'll
    find the one to put this into that balances responsiveness. Thanks.

    Bill
    -----------------------
    "Vic Eldridge" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Bill,
    >
    > Try calling the DoEvents function throughout your code. If you have a loop
    > that's running millions of times, stick a DoEvents inside that loop.
    >
    > Regards,
    > Vic Eldridge
    >
    >
    > "Bill Martin" wrote:
    >
    >> I'm not sure if this is a VBA question, an Excel question, or an XP
    >> question, but is there a way to limit how much CPU Excel burns?
    >>
    >> I've written a macro that will endlessly run a Monte Carlo solution.
    >> Normally I run it overnight and all is well. Sometimes however I run it
    >> during the day, particularly if I'm tinkering with the code and want to
    >> run
    >> it in the background to watch how it performs. When I do this it pegs
    >> CPU
    >> usage at 100% and makes everything else on the machine painfully
    >> sluggish.
    >>
    >> Is there some way to cut back on how much CPU Excel consumes? Ideally
    >> I'd
    >> like my VBA routine to periodically sample CPU usage and adjust what
    >> Excel
    >> consumes. Alternatively, is there someway I can manually adjust it?
    >>
    >> Thanks.
    >>
    >> Bill
    >>
    >>



  7. #7
    Bill Martin
    Guest

    Re: Limit CPU Usage

    You're probably right about multi-core. I don't know if XP gives you power
    to manually assign processors in a multi-processor system? (i.e. Give one
    CPU to Excel, and run everything else on the other.)

    I've been considering resuscitating an old Win98 machine I have kicking
    around and devoting it to running this problem (if the computer still runs).
    That's sort of a poor man's multi processor approach. <g>

    Bill
    -----------------------------
    "Charles Williams" <[email protected]> wrote in message
    news:[email protected]...
    > Sounds like a situation where a multi-core system would be ideal: Excel
    > versions prior to Excel2007 do single-threaded calculation so you would
    > only be using 1 cpu leaving the other free.
    > (In Excel 2007 you can control how many calculation threads to use).
    >
    >
    > BTW if you are using range.calculate in your montecarlo simulation it runs
    > a lot faster in excel versions 97 and 2000 than 2002 /2003.
    >
    > regards
    > Charles
    > ______________________
    > Decision Models
    > FastExcel 2.2 Beta now available
    > www.DecisionModels.com
    >
    > "Bill Martin" <[email protected]> wrote in message
    > news:%[email protected]...
    >> I'm not sure if this is a VBA question, an Excel question, or an XP
    >> question, but is there a way to limit how much CPU Excel burns?
    >>
    >> I've written a macro that will endlessly run a Monte Carlo solution.
    >> Normally I run it overnight and all is well. Sometimes however I run it
    >> during the day, particularly if I'm tinkering with the code and want to
    >> run it in the background to watch how it performs. When I do this it
    >> pegs CPU usage at 100% and makes everything else on the machine painfully
    >> sluggish.
    >>
    >> Is there some way to cut back on how much CPU Excel consumes? Ideally
    >> I'd like my VBA routine to periodically sample CPU usage and adjust what
    >> Excel consumes. Alternatively, is there someway I can manually adjust
    >> it?
    >>
    >> Thanks.
    >>
    >> Bill

    >
    >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1