UNPKG

706 BJavaScriptView Raw
1'use strict'
2
3const summary = require('summary')
4
5function performanceIssue (issue) {
6 return issue ? 'performance' : 'none'
7}
8
9function analyseDelay (systemInfo, processStatSubset, traceEventSubset) {
10 const stats = summary(processStatSubset.map((d) => d.delay))
11
12 // If there is a 10ms event loop delay, we can't handle connections for 10ms
13 // that is actually pretty bad. There are also some cases, where the GC
14 // stops the world for a long time. This doesn't happen often, but just
15 // once can be an issue. Check for that, by looking at the max value.
16 // Note: units are in milliseconds
17 return performanceIssue(stats.median() >= 10 || stats.max() >= 100)
18}
19
20module.exports = analyseDelay