lib/master.js
function collect_worker_stats(worker, worker_type) {
		var stats;
		var band = ('band' in worker) ? worker.band : worker.xband;

		stats = worker.getStats();

		if (!('monitor_count' in stats))
			stats.monitor_count = 1;
		else
			stats.monitor_count++;

		// TODO: if a given stats object has been used to many times, something is wrong!

		if (!collected[band]) {
			collected[band] = {
				live: null, retired: []
			};
		}

		if (worker_type === 'live') {
			collected[band].live = stats;
		}
		else {
			collected[band].retired.push(stats);
		}

		var worker_rss = (stats && stats.mem && stats.mem.rss) || 0;

		cluster_rss += worker_rss;

		return worker_rss;
	}
function collect_worker_stats(worker, worker_type) {
		var stats;
		var band = ('band' in worker) ? worker.band : worker.xband;

		stats = worker.getStats();

		if (!('monitor_count' in stats))
			stats.monitor_count = 1;
		else
			stats.monitor_count++;

		// TODO: if a given stats object has been used to many times, something is wrong!

		if (!collected[band]) {
			collected[band] = {
				live: null, retired: []
			};
		}

		if (worker_type === 'live') {
			collected[band].live = stats;
		}
		else {
			collected[band].retired.push(stats);
		}

		var worker_rss = (stats && stats.mem && stats.mem.rss) || 0;

		cluster_rss += worker_rss;

		return worker_rss;
	}
function collect_worker_stats ( worker , worker_type ) { var stats ; var band = ( 'band' in worker ) ? worker . band : worker . xband ; stats = worker . getStats ( ) ; if ( ! ( 'monitor_count' in stats ) ) stats . monitor_count = 1 ; else stats . monitor_count ++ ; // TODO: if a given stats object has been used to many times, something is wrong! if ( ! collected [ band ] ) { collected [ band ] = { live : null , retired : [ ] } ; } if ( worker_type === 'live' ) { collected [ band ] . live = stats ; } else { collected [ band ] . retired . push ( stats ) ; } var worker_rss = ( stats && stats . mem && stats . mem . rss ) || 0 ; cluster_rss += worker_rss ; return worker_rss ; }
Aggregate the worker stats into a data structure that will be passed to emitted events The function also returns the rss for that one worker
Aggregate the worker stats into a data structure that will be passed to emitted events The function also returns the rss for that one worker