Thread Subject: why does "doing nothing" consume so much CPU?

Subject: why does "doing nothing" consume so much CPU?

From: Bruce Bowler

Date: 30 Apr, 2009 18:01:47

Message: 1 of 5

I'm running 2006a on a fedora 9 system. I have the following m file
that, when run, consumes about 15% of the CPU.

function sleep4(snoozeTime)
if (snoozeTime > 0)
    t=timer('timerfcn','sleep4(0)','StartDelay',snoozeTime);
    start(t); wait(t);
end

Why (and is there a better way to "do nothing" for some period of time).



--
+-------------------+---------------------------------------------------+
Bruce Bowler | It's not a sin to be rich anymore it's a miracle.
1.207.633.9600 | - John Connally
bbowler@bigelow.org |
+-------------------+---------------------------------------------------+

Subject: why does "doing nothing" consume so much CPU?

From: vgood

Date: 30 Apr, 2009 18:53:00

Message: 2 of 5

Bruce Bowler <bbowler@bigelow.org> wrote in message <75u7cbF19h2ujU1@mid.individual.net>...
> I'm running 2006a on a fedora 9 system. I have the following m file
> that, when run, consumes about 15% of the CPU.
>
> function sleep4(snoozeTime)
> if (snoozeTime > 0)
> t=timer('timerfcn','sleep4(0)','StartDelay',snoozeTime);
> start(t); wait(t);
> end
>
> Why (and is there a better way to "do nothing" for some period of time).
>
>
>
> --
> +-------------------+---------------------------------------------------+
> Bruce Bowler | It's not a sin to be rich anymore it's a miracle.
> 1.207.633.9600 | - John Connally
> bbowler@bigelow.org |
> +-------------------+---------------------------------------------------+

Bruce,

There just isn't a real "do nothing" mode that I can think of. Even pause is going to consume some CPU time but it might be less overhead than your timer object. I'll give it a quick test if my ML can ever access the license server lol.

Subject: why does "doing nothing" consume so much CPU?

From: James_F Falco

Date: 30 Apr, 2009 18:54:02

Message: 3 of 5


> is there a better way to "do nothing" for some period of time
help pause

Subject: why does "doing nothing" consume so much CPU?

From: vgood

Date: 30 Apr, 2009 18:54:02

Message: 4 of 5

Bruce Bowler <bbowler@bigelow.org> wrote in message <75u7cbF19h2ujU1@mid.individual.net>...
> I'm running 2006a on a fedora 9 system. I have the following m file
> that, when run, consumes about 15% of the CPU.
>
> function sleep4(snoozeTime)
> if (snoozeTime > 0)
> t=timer('timerfcn','sleep4(0)','StartDelay',snoozeTime);
> start(t); wait(t);
> end
>
> Why (and is there a better way to "do nothing" for some period of time).
>
>
>
> --
> +-------------------+---------------------------------------------------+
> Bruce Bowler | It's not a sin to be rich anymore it's a miracle.
> 1.207.633.9600 | - John Connally
> bbowler@bigelow.org |
> +-------------------+---------------------------------------------------+

Bruce,

There just isn't a real "do nothing" mode that I can think of. Even pause is going to consume some CPU time but it might be less overhead than your timer object. I'll give it a quick test if my ML can ever access the license server lol.

Subject: why does "doing nothing" consume so much CPU?

From: Bruce Bowler

Date: 30 Apr, 2009 20:16:13

Message: 5 of 5

On Thu, 30 Apr 2009 18:54:02 +0000, James_F Falco wrote:

>> is there a better way to "do nothing" for some period of time
> help pause

Well, I'd looked at that but not closely enough (my bad, sorry for
wasting peoples time). I saw the reference to keyboard input and missed
the (n). Since this is needed in a "non-interactive" environment, I
dismissed it as a non-starter.

Regarding vgoods idea to test, save your time. I just ran the test here
and a 60 second run of my timer consumes about 15% (as stated earlier),
pause, on the other hand, only about 3%. Sounds like we have a winner...

Bruce


--
+-------------------+---------------------------------------------------+
Bruce Bowler | How can you be two places at once when you're not
1.207.633.9600 | anywhere at all. - Firesign Theater
bbowler@bigelow.org |
+-------------------+---------------------------------------------------+

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com