本文整理汇总了TypeScript中v8-profiler.stopProfiling函数的典型用法代码示例。如果您正苦于以下问题:TypeScript stopProfiling函数的具体用法?TypeScript stopProfiling怎么用?TypeScript stopProfiling使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stopProfiling函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: exitHandler
function exitHandler(options: any, _err: Error) {
if (options.cleanup) {
const cpuProfile = profiler.stopProfiling();
fs.writeFileSync(path.resolve(process.cwd(), process.env.NG_CLI_PROFILING) + '.cpuprofile',
JSON.stringify(cpuProfile));
}
if (options.exit) {
process.exit();
}
}
示例2:
const exitHandler = (options: { cleanup?: boolean, exit?: boolean }) => {
if (options.cleanup) {
const cpuProfile = profiler.stopProfiling();
fs.writeFileSync(
path.resolve(process.cwd(), process.env.NG_CLI_PROFILING || '') + '.cpuprofile',
JSON.stringify(cpuProfile),
);
}
if (options.exit) {
process.exit();
}
};
示例3: setTimeout
setTimeout(function () {
var profile = profiler.stopProfiling('');
profiler.deleteAllProfiles();
}, 1000);
示例4: function
console.log(snapshot1.compare(snapshot2));
// Export snapshot to file file
snapshot1.export(function (error, result) {
fs.writeFileSync('snapshot1.json', result);
snapshot1.delete();
});
// Export snapshot to file stream
snapshot2.export()
.pipe(fs.createWriteStream('snapshot2.json'))
.on('finish', snapshot2.delete);
}
{
profiler.startProfiling('1', true);
var profile1 = profiler.stopProfiling();
profiler.startProfiling('2', true);
var profile2 = profiler.stopProfiling();
console.log(snapshot1.getHeader(), snapshot2.getHeader());
profile1.export(function (error, result) {
fs.writeFileSync('profile1.json', result);
profile1.delete();
});
profile2.export()
.pipe(fs.createWriteStream('profile2.json'))
.on('finish', function () {
profile2.delete();
});
示例5: findAll
import { createWriteStream } from 'fs'
import * as profiler from 'v8-profiler'
import { findAll } from '..'
import { ALL_CONSTRAINTS } from './pentomino/field'
profiler.startProfiling('1', true)
findAll(ALL_CONSTRAINTS)
const profile = profiler.stopProfiling()
profile.export().pipe(createWriteStream('profile.cpuprofile'))