node bindings for the v8 profiler
npm install v8-profiler
var profiler = ;
takeSnapshot([name]) - returns new HEAP Snapshot instance.
name is optional argument, by default snapshot name will be constructed from his uid.
deleteAllSnapshots() - works as described in name.
var snapshot1 = profiler;var snapshot2 = profiler;profiler;
startProfiling([name], [recsamples]) - start CPU profiling.
name is optional argument, by default profile name will be constructed from his uid.
recsamples is true by default.
stopProfiling([name]) - returns new CPU Profile instance. There is no strictly described behavior for usage without
setSamplingInterval([num]) - Changes default CPU profiler sampling interval to the specified number of microseconds. Default interval is 1000us. This method must be called when there are no profiles being recorded. If called without arguments it resets interval to default.
deleteAllProfiles() - works as described in name.
Snapshot.getHeader() - provides short information about snapshot.
Snapshot.compare(snapshot) - creates HEAP diff for two snapshots.
Snapshot.delete() - removes snapshot from memory.
Snapshot.export([callback]) - provides simple export API for snapshot.
callback(error, data) receives serialized snapshot as second argument. (Serialization is not equal to
If callback will not be passed,
export returns transform stream.
Snapshot.serialize - low level serialization method. Look
Snapshot.export source for usage example.
var fs = ;var profiler = ;var snapshot1 = profiler;var snapshot2 = profiler;console;console;// Export snapshot to file filesnapshot1;// Export snapshot to file streamsnapshot2;
Profile.getHeader() - provides short information about profile.
Profile.delete() - removes profile from memory.
Profile.export([callback]) - provides simple export API for profile.
callback(error, data) receives serialized profile as second argument. (Serialization is equal to
var fs = ;var profiler = ;profiler;var profile1 = profiler;profiler;var profile2 = profiler;console;profile1;profile2;
Cpu profiles can be viewed and heap snapshots may be taken and viewed from the profiles panel.