Comments (3)
const v8Profiler = require('v8-profiler-next')
const generateVmHeapsnapshot = (options, callback) => {
try {
const { cupFilePath } = options
console.log('EnterGenerateSnapshot', cupFilePath)
const snapshot = v8Profiler.takeSnapshot()
console.log('AfterGenerateSnapshot')
// 1. not as stream
const file = fs.createWriteStream(cupFilePath);
const transform = snapshot.export();
transform.pipe(file);
transform.on('finish', snapshot.delete.bind(snapshot));
} catch(e) {
console.log('GenerateVmHeapsnapshotError', e)
}
}
这段代码执行完之后,就会看到进程的cpu立即上升到接近100%,这属于正常现象吗?node版本:12.16.1
from v8-profiler-next.
这是正常的,堆快照序列化是一个比较大的开销,等堆快照生成 cpu 会降下来。
from v8-profiler-next.
相比之下,进程堆内存比较大时,生成的堆快照的体积一般也比较大,且会耗费一定的时间,这个是没问题的。
from v8-profiler-next.
Related Issues (20)
- .cpuprofile looks empty in vscode HOT 4
- Requiring v8-profiler-next fails across multiple threads. HOT 2
- Error 127 in profiler.node file HOT 5
- support napi builds HOT 1
- Fail to install on 16 alpine HOT 4
- Aarch64 platform load error HOT 4
- Hi, this node can use in Electron? HOT 4
- Node12正常,Node10部署报错 HOT 1
- 这个报错是为啥,这个ip现在公司服务器ping不通 HOT 4
- host mirror 冲突 HOT 1
- electron中使用报错 Error: The specified procedure could not be found HOT 2
- Fix `@npmcli/[email protected]` deprecation warning HOT 3
- 报错找不到模块 profiler.node HOT 1
- Bug: setGenerateType only accepts type = 1 HOT 2
- Unable to install HOT 2
- Node.js v20 Release HOT 10
- The idle usage statistics may be incorrect
- no template named 'is_lvalue_reference_v' in namespace 'std' HOT 1
- Timings including idle time? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v8-profiler-next.