Use Node.js in your end devices(QQ: 796448809)
The profiler module provides memory and CPU profiler methods. It can be accessed using:
var profiler = require('profiler');
The profiler.startProfiling(path) method start a CPU profiler, which should be explicitly stopped by profiler.stopProfiling
The profiling data will be stored into a file ${process.cwd()}/Profile-${Date.now()}.
path {String} profiling data file pathThe profiler.startProfiling(path) method start a CPU profiler, which should be explicitly stopped by profiler.stopProfiling
duration {Number}The profiler.startProfiling(duration) method start a CPU profiler, which will stop after duration milliseconds.
The profiling data will be stored into a file ${process.cwd()}/Profile-${Date.now()}.
path {String} profiling data file pathduration {Number}The profiler.startProfiling(path, duration) method start a CPU profiler, which will stop after duration milliseconds.
path {String} profiling data file pathThe profiler.takeSnapshot() methd take a Heap profiler file which path is path.
If path is not provided, it will be set to ${process.cwd()}/Profile-${Date.now()}
Example
var profiler = require('profiler');
profiler.startProfiling();
balabala...
profiler.stopProfiling();
var profiler = require('profiler');
profiler.startProfiling('/data/profile-123.txt');
balabala...
profiler.stopProfiling();
var profiler = require('profiler');
profiler.startProfiling(1000);
balabala...
var profiler = require('profiler');
profiler.startProfiling('/data/profile-123.txt', 1000);
balabala...
var profiler = require('profiler');
profiler.takeSnapshot();
```js var profiler = require(‘profiler’); profiler.takeSnapshot(‘/data/profile-123.txt’);