Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: why does "doing nothing" consume so much CPU?
Date: Thu, 30 Apr 2009 18:54:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <gtcs4a$kdo$1@fred.mathworks.com>
References: <75u7cbF19h2ujU1@mid.individual.net>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1241117642 20920 172.30.248.37 (30 Apr 2009 18:54:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 30 Apr 2009 18:54:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869596
Xref: news.mathworks.com comp.soft-sys.matlab:536528


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.