nodegrind.js
function writeProfile() {
        var format;
        if (/\.cpuprofile$/.test(argv.o)) {
            format = 'cpuprofile';
        }

        var prof = stopCPU('global', format);
		fs.writeFileSync(argv.o, prof);
		var fname = JSON.stringify(argv.o);
		console.warn('Profile written to', fname + '\nTry `kcachegrind', fname + '`');
        process.removeAllListeners('exit');
        process.exit(0);
	}
function writeProfile() {
        var format;
        if (/\.cpuprofile$/.test(argv.o)) {
            format = 'cpuprofile';
        }

        var prof = stopCPU('global', format);
		fs.writeFileSync(argv.o, prof);
		var fname = JSON.stringify(argv.o);
		console.warn('Profile written to', fname + '\nTry `kcachegrind', fname + '`');
        process.removeAllListeners('exit');
        process.exit(0);
	}
function writeProfile ( ) { var format ; if ( / \.cpuprofile$ / . test ( argv . o ) ) { format = 'cpuprofile' ; } var prof = stopCPU ( 'global' , format ) ; fs . writeFileSync ( argv . o , prof ) ; var fname = JSON . stringify ( argv . o ) ; console . warn ( 'Profile written to' , fname + '\nTry `kcachegrind' , fname + '`' ) ; process . removeAllListeners ( 'exit' ) ; process . exit ( 0 ) ; }
Stop profiling in an exit handler so that we properly handle async code
Stop profiling in an exit handler so that we properly handle async code