Print next step recommendation to console (#229)

* print next step recommendation to console

* update messages

* add check for collect only argument

* remove whitespace
This commit is contained in:
Conor 2020-04-27 17:38:59 +01:00 committed by GitHub
parent 9f1e90ff09
commit b4bab3b403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

21
bin.js
View File

@ -611,6 +611,27 @@ async function runTool (args, Tool, version, uiOptions) {
console.log(`Output file is ${outputs.data}`)
}
if (Tool.name === 'ClinicDoctor' && !args['collect-only']) {
try {
const iss = tool.getIssue()
const proc = args['--'][args['--'].length - 1]
if (iss !== 'none') {
console.log(`Doctor detected a potential ${iss} issue.`)
}
if (iss === 'event-loop') {
console.log('To get started with diagnosing the issue run:')
console.log(`clinic flame --autocannon [ / ] -- node ${proc}`)
} else if (iss === 'io') {
console.log('To get started with diagnosing the issue run:')
console.log(`clinic bubbleprof --autocannon [ / ] -- node ${proc}`)
} else if (iss === 'data') {
console.log('Try running the benchmark for a longer time.')
}
} catch (err) {
// The version of Doctor used does not have a getIssue() function
}
}
// rest is util functions
function viz (filename, cb) {