
var _os = require('os');
var _source = _os.hostname();
var _interval = parseInt(process.argv[1]) || 1000;

function poll()
{
	var cpus = _os.cpus();

	for(var idx = 0; idx < cpus.length; idx++)
	{
		var e = cpus[idx];
		var total = e.times.user + e.times.nice +
					e.times.sys + e.times.idle;
		var user = e.times.user / total;

		console.log('CPU_CORE %d %s-%d',
			user, _source, idx + 1);
	}

	setTimeout(poll, _interval);
}

poll();

@@ -101,16 +101,28 @@
  1000;%0A%0A
+var _last;%0A%0A
 function
@@ -230,20 +230,18 @@
 ;%0A%09%09
-var 
+e.
 total = 
 e.ti
@@ -240,30 +240,56 @@
 l = 
-e.times.user
+0;%0A%09%09for(var t in e.times)%0A%09%09%09e.total
  +
+=
  e.times
 .nic
@@ -288,49 +288,127 @@
 imes
-.nice +
+%5Bt%5D;%0A%09%7D%0A%0A%09if (_last)%0A%09%7B%0A%09%09for(var idx = 0; idx %3C cpus.length; idx++)
 %0A%09%09
+%7B%0A
 %09%09%09
-e.times.sys + e.times.idle
+var e = cpus%5Bidx%5D;%0A%09%09%09var l = _last%5Bidx%5D
 ;%0A
+%09
 %09%09va
@@ -416,16 +416,17 @@
  user = 
+(
 e.times.
@@ -434,18 +434,58 @@
 ser 
-/ total
+- l.times.user)  /%0A%09%09%09%09%09   (e.total - l.total)
 ;%0A%0A
+%09
 %09%09co
@@ -515,16 +515,17 @@
 %25s-%25d',%0A
+%09
 %09%09%09user,
@@ -545,17 +545,37 @@
  + 1);%0A%09
-%7D
+%09%7D%0A%09%7D%0A%0A%09_last = cpus;
 %0A%0A%09setTi

use accumulator