<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250288</link>
    <title>MATLAB Central Newsreader - why does &quot;doing nothing&quot; consume so much CPU?</title>
    <description>Feed for thread: why does &quot;doing nothing&quot; consume so much CPU?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 30 Apr 2009 18:01:47 -0400</pubDate>
      <title>why does &quot;doing nothing&quot; consume so much CPU?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250288#646471</link>
      <author>Bruce Bowler</author>
      <description>I'm running 2006a on a fedora 9 system.  I have the following m file &lt;br&gt;
that, when run, consumes about 15% of the CPU.  &lt;br&gt;
&lt;br&gt;
function sleep4(snoozeTime)&lt;br&gt;
if (snoozeTime &amp;gt; 0) &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;t=timer('timerfcn','sleep4(0)','StartDelay',snoozeTime);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;start(t);  wait(t);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Why (and is there a better way to &quot;do nothing&quot; for some period of time).&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
+-------------------+---------------------------------------------------+&lt;br&gt;
Bruce Bowler        | It's not a sin to be rich anymore it's a miracle.  &lt;br&gt;
1.207.633.9600      | - John Connally   &lt;br&gt;
bbowler@bigelow.org | &lt;br&gt;
+-------------------+---------------------------------------------------+</description>
    </item>
    <item>
      <pubDate>Thu, 30 Apr 2009 18:53:00 -0400</pubDate>
      <title>Re: why does &quot;doing nothing&quot; consume so much CPU?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250288#646477</link>
      <author>vgood </author>
      <description>Bruce Bowler &amp;lt;bbowler@bigelow.org&amp;gt; wrote in message &amp;lt;75u7cbF19h2ujU1@mid.individual.net&amp;gt;...&lt;br&gt;
&amp;gt; I'm running 2006a on a fedora 9 system.  I have the following m file &lt;br&gt;
&amp;gt; that, when run, consumes about 15% of the CPU.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function sleep4(snoozeTime)&lt;br&gt;
&amp;gt; if (snoozeTime &amp;gt; 0) &lt;br&gt;
&amp;gt;     t=timer('timerfcn','sleep4(0)','StartDelay',snoozeTime);&lt;br&gt;
&amp;gt;     start(t);  wait(t);&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why (and is there a better way to &quot;do nothing&quot; for some period of time).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; +-------------------+---------------------------------------------------+&lt;br&gt;
&amp;gt; Bruce Bowler        | It's not a sin to be rich anymore it's a miracle.  &lt;br&gt;
&amp;gt; 1.207.633.9600      | - John Connally   &lt;br&gt;
&amp;gt; bbowler@bigelow.org | &lt;br&gt;
&amp;gt; +-------------------+---------------------------------------------------+&lt;br&gt;
&lt;br&gt;
Bruce,&lt;br&gt;
&lt;br&gt;
There just isn't a real &quot;do nothing&quot; 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.</description>
    </item>
    <item>
      <pubDate>Thu, 30 Apr 2009 18:54:02 -0400</pubDate>
      <title>Re: why does &quot;doing nothing&quot; consume so much CPU?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250288#646478</link>
      <author>James_F Falco</author>
      <description>&lt;br&gt;
&amp;gt; is there a better way to &quot;do nothing&quot; for some period of time&lt;br&gt;
help pause</description>
    </item>
    <item>
      <pubDate>Thu, 30 Apr 2009 18:54:02 -0400</pubDate>
      <title>Re: why does &quot;doing nothing&quot; consume so much CPU?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250288#646479</link>
      <author>vgood </author>
      <description>Bruce Bowler &amp;lt;bbowler@bigelow.org&amp;gt; wrote in message &amp;lt;75u7cbF19h2ujU1@mid.individual.net&amp;gt;...&lt;br&gt;
&amp;gt; I'm running 2006a on a fedora 9 system.  I have the following m file &lt;br&gt;
&amp;gt; that, when run, consumes about 15% of the CPU.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function sleep4(snoozeTime)&lt;br&gt;
&amp;gt; if (snoozeTime &amp;gt; 0) &lt;br&gt;
&amp;gt;     t=timer('timerfcn','sleep4(0)','StartDelay',snoozeTime);&lt;br&gt;
&amp;gt;     start(t);  wait(t);&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why (and is there a better way to &quot;do nothing&quot; for some period of time).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; +-------------------+---------------------------------------------------+&lt;br&gt;
&amp;gt; Bruce Bowler        | It's not a sin to be rich anymore it's a miracle.  &lt;br&gt;
&amp;gt; 1.207.633.9600      | - John Connally   &lt;br&gt;
&amp;gt; bbowler@bigelow.org | &lt;br&gt;
&amp;gt; +-------------------+---------------------------------------------------+&lt;br&gt;
&lt;br&gt;
Bruce,&lt;br&gt;
&lt;br&gt;
There just isn't a real &quot;do nothing&quot; 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.</description>
    </item>
    <item>
      <pubDate>Thu, 30 Apr 2009 20:16:13 -0400</pubDate>
      <title>Re: why does &quot;doing nothing&quot; consume so much CPU?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250288#646494</link>
      <author>Bruce Bowler</author>
      <description>On Thu, 30 Apr 2009 18:54:02 +0000, James_F Falco wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; is there a better way to &quot;do nothing&quot; for some period of time&lt;br&gt;
&amp;gt; help pause&lt;br&gt;
&lt;br&gt;
Well, I'd looked at that but not closely enough (my bad, sorry for &lt;br&gt;
wasting peoples time).  I saw the reference to keyboard input and missed &lt;br&gt;
the (n).  Since this is needed in a &quot;non-interactive&quot; environment, I &lt;br&gt;
dismissed it as a non-starter.&lt;br&gt;
&lt;br&gt;
Regarding vgoods idea to test, save your time.  I just ran the test here &lt;br&gt;
and a 60 second run of my timer consumes about 15% (as stated earlier), &lt;br&gt;
pause, on the other hand, only about 3%.  Sounds like we have a winner...&lt;br&gt;
&lt;br&gt;
Bruce&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
+-------------------+---------------------------------------------------+&lt;br&gt;
Bruce Bowler        | How can you be two places at once when you're not&lt;br&gt;
1.207.633.9600      | anywhere at all.  - Firesign Theater   &lt;br&gt;
bbowler@bigelow.org | &lt;br&gt;
+-------------------+---------------------------------------------------+</description>
    </item>
  </channel>
</rss>

