@r_kumar84/test-nm
Version:
Monitor Native matrics like GC and Event loop stats
32 lines (27 loc) • 1.39 kB
JavaScript
/**
* Copyright (c) 2015 CA. All rights reserved.
*
* This software and all information contained therein is confidential and proprietary and
* shall not be duplicated, used, disclosed or disseminated in any way except as authorized
* by the applicable license agreement, without the express written permission of CA. All
* authorized reproductions must be marked with this language.
*
* EXCEPT AS SET FORTH IN THE APPLICABLE LICENSE AGREEMENT, TO THE EXTENT
* PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS SOFTWARE WITHOUT WARRANTY
* OF ANY KIND, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL CA BE
* LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR
* INDIRECT, FROM THE USE OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, LOST
* PROFITS, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF CA IS
* EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE.
*/
var eventLoopStats = require('event-loop-stats');
exports.poll = function() {
var statistics = eventLoopStats.sense();
if (statistics.num === 0) {
return null;
}
// XXX(bnoordhuis) Backwards compatible field names.
// XXX(bnoordhuis) fastest_ms is new though.
return {count: statistics.num, fastest_ms: statistics.min, slowest_ms: statistics.max, sum_ms: (statistics.sum * statistics.num)};
};