mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
PR-URL: https://github.com/nodejs/node/pull/62684 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: theanarkh <theratliter@gmail.com>
24 lines
586 B
JavaScript
24 lines
586 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const v8 = require('v8');
|
|
|
|
{
|
|
const handle = v8.startCpuProfile();
|
|
const profile = handle.stop();
|
|
assert.ok(typeof profile === 'string');
|
|
assert.ok(profile.length > 0);
|
|
// Call stop() again
|
|
assert.ok(handle.stop() === undefined);
|
|
}
|
|
{
|
|
assert.throws(
|
|
() => v8.startCpuProfile({ sampleInterval: -1 }),
|
|
common.expectsError({ code: 'ERR_OUT_OF_RANGE' }));
|
|
|
|
assert.throws(
|
|
() => v8.startCpuProfile({ maxBufferSize: 0 }),
|
|
common.expectsError({ code: 'ERR_OUT_OF_RANGE' }));
|
|
}
|