<div dir="ltr">Hi Tim,<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 9, 2015 at 12:39 PM, tim Rowledge <span dir="ltr">&lt;<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
<br>
On 09-02-2015, at 12:33 PM, <a href="mailto:phil@highoctane.be">phil@highoctane.be</a> wrote:<br>
<br>
&gt; Can&#39;t the box be setup 5o do some WoL thing and go back to sleep when idling for a while?<br>
&gt;<br>
&gt; This CPU usage is really annoying indeed.<br>
<br>
Assuming you are using a stack or Cog vm, that will mostly be the heartbeat that checks for inputs and process switches and GC limits etc. Plus any remaining morphic loop etc.<br></blockquote><div><br></div><div>No.  The heartbeat is extremely cheap.  It is the idle loop that calls ioRelinquishProcessorForMicroseconds which in turn calls aioSleepForUsecs which calls select:</div><div><br></div><div><div>(Delay forSeconds: 60) wait</div><div><br></div><div>gc prior.  clear prior.  </div><div>60.002 seconds; sampling frequency 1385 hz</div><div>7 samples in the VM<span class="" style="white-space:pre">        </span>(83120 samples in the entire program)    0.01% of total</div><div><br></div><div>3 samples in generated vm code 42.86% of entire vm (  0.00% of total)</div><div>4 samples in vanilla vm code 57.14% of entire vm (  0.00% of total)</div><div><br></div><div>% of generated vm code (% of total)<span class="" style="white-space:pre">        </span>(samples) (cumulative)</div><div>100.0%    (  0.00%)<span class="" style="white-space:pre">        </span>...others...<span class="" style="white-space:pre">                </span>(3)<span class="" style="white-space:pre">                </span>(100.0%)</div><div><br></div><div><br></div><div>% of vanilla vm code (% of total)<span class="" style="white-space:pre">        </span>(samples) (cumulative)</div><div>100.0%    (  0.00%)<span class="" style="white-space:pre">        </span>...others...<span class="" style="white-space:pre">        </span>(4)<span class="" style="white-space:pre">                </span>(100.0%)</div><div><br></div><div><br></div><div>83113 samples in the rest  99.99% of total</div><div><br></div><div>% of rest (% of total)<span class="" style="white-space:pre">                                                        </span>(samples) (cumulative)</div><div>99.98%    (99.97%)<span class="" style="white-space:pre">        </span>select$DARWIN_EXTSN<span class="" style="white-space:pre">        </span>(83095)<span class="" style="white-space:pre">        </span>(99.98%)</div><div>  0.01%    (  0.01%)<span class="" style="white-space:pre">        </span>mach_msg_trap<span class="" style="white-space:pre">                </span>(10)<span class="" style="white-space:pre">                </span>(99.99%)</div><div>  0.01%    (  0.01%)<span class="" style="white-space:pre">        </span>...others...<span class="" style="white-space:pre">                                </span>(8)<span class="" style="white-space:pre">                </span>(100.0%)</div></div><div><br></div><div>Now using epoll would make the select cheaper and I have changes for that.  But the real solution is to combine this with an event-driven VM.</div></div><br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>