Hi Tim,
On Mon, Feb 9, 2015 at 12:39 PM, tim Rowledge tim@rowledge.org wrote:
On 09-02-2015, at 12:33 PM, phil@highoctane.be wrote:
Can't the box be setup 5o do some WoL thing and go back to sleep when
idling for a while?
This CPU usage is really annoying indeed.
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.
No. The heartbeat is extremely cheap. It is the idle loop that calls ioRelinquishProcessorForMicroseconds which in turn calls aioSleepForUsecs which calls select:
(Delay forSeconds: 60) wait
gc prior. clear prior. 60.002 seconds; sampling frequency 1385 hz 7 samples in the VM (83120 samples in the entire program) 0.01% of total
3 samples in generated vm code 42.86% of entire vm ( 0.00% of total) 4 samples in vanilla vm code 57.14% of entire vm ( 0.00% of total)
% of generated vm code (% of total) (samples) (cumulative) 100.0% ( 0.00%) ...others... (3) (100.0%)
% of vanilla vm code (% of total) (samples) (cumulative) 100.0% ( 0.00%) ...others... (4) (100.0%)
83113 samples in the rest 99.99% of total
% of rest (% of total) (samples) (cumulative) 99.98% (99.97%) select$DARWIN_EXTSN (83095) (99.98%) 0.01% ( 0.01%) mach_msg_trap (10) (99.99%) 0.01% ( 0.01%) ...others... (8) (100.0%)
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.
best, Eliot