v8-profiler-next
Advanced tools
Comparing version 1.4.3 to 1.5.0
@@ -221,2 +221,11 @@ 'use strict'; | ||
setGenerateType: function (type) { | ||
const types = [0, 1]; | ||
if (types.indexOf(type) > 0) { | ||
binding.cpu.setGenerateType(type); | ||
} else { | ||
console.error(`type should in [${types.join(', ')}], got ${type}.`); | ||
} | ||
}, | ||
startProfiling: function (name, recsamples) { | ||
@@ -232,3 +241,3 @@ if (activeProfiles.length == 0 && typeof process._startProfilerIdleNotifier == "function") | ||
recsamples = recsamples === undefined ? true : Boolean(recsamples); | ||
name = '' + name; | ||
name = name && '' + name || ''; | ||
@@ -300,2 +309,2 @@ if (activeProfiles.indexOf(name) < 0) | ||
module.exports = profiler; | ||
process.profiler = profiler; | ||
process.profiler = profiler; |
@@ -15,2 +15,3 @@ import { Stream } from "stream"; | ||
*/ | ||
export function setGenerateType(type: 0 | 1): void; | ||
export function stopProfiling(name?: string): CpuProfile; | ||
@@ -74,3 +75,3 @@ export function deleteAllProfiles(): void; | ||
export class ExportStream extends Stream.Transform {} | ||
export class ExportStream extends Stream.Transform { } | ||
@@ -77,0 +78,0 @@ export class Snapshot extends Profile { |
{ | ||
"name": "v8-profiler-next", | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"description": "node bindings for the v8 profiler", | ||
@@ -5,0 +5,0 @@ "main": "dispatch.js", |
@@ -24,4 +24,10 @@ # v8-profiler-next | ||
'use strict'; | ||
const fs = require('fs'); | ||
const v8Profiler = require('v8-profiler-next'); | ||
const title = 'good-name'; | ||
// set generateType 1 to generate new format for cpuprofile | ||
// to be compatible with cpuprofile parsing in vscode. | ||
v8Profiler.setGenerateType(1); | ||
// ex. 5 mins cpu profile | ||
@@ -28,0 +34,0 @@ v8Profiler.startProfiling(title, true); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59238
357
99