Comments (2)
I think we can not use pprof in both the main thread and the worker thread, but we can use it in worker thread as follows.
const { Worker, isMainThread } = require('worker_threads');
// Can not be loaded in both the main thread and the worker thread
// const profile = require('pprof');
if (isMainThread) {
new Worker(__filename)
} else {
const profile = require('pprof');
// Removing this will cause a crash
process._stopProfilerIdleNotifier = process._startProfilerIdleNotifier = () => {};
profile.time.profile({
durationMillis: 1000,
});
}
from pprof-nodejs.
- node_modules/pprof/profiles.cc I have changed
NODE_MODULE(google_cloud_profiler, InitAll);
toNAN_MODULE_WORKER_ENABLED(google_cloud_profiler, InitAll);
cd node_modules/pprof/build && make
- as @theanarkh said before calling
profile
I've added this lineprocess._stopProfilerIdleNotifier = process._startProfilerIdleNotifier = () => {};
Worker profiling totally working now
from pprof-nodejs.
Related Issues (20)
- Cannot npm install [email protected] with node 12.16.1 HOT 1
- Action Required: Fix Renovate Configuration
- Error installing pprof with nodejs v14 HOT 2
- Add support for Node 17 and 18. Drop support for Node 10, 12 and 15. HOT 10
- Add support for Node 16
- Dependency Dashboard
- Receiving a 404 error on Apple M1
- Receiving a 404 error on Apple M1 HOT 2
- Remove feature "requiring from the command line"
- CVE-2023-36665 vunerablity in protobufjs >= 6.10.0, < 7.2.4 HOT 1
- [node 20] Compilation error on nan HOT 9
- System test failing for Node 21 HOT 1
- Publish pre-built binaries for native components for Windows
- Stop suppressing warnings with -Wno-cast-function-type HOT 1
- Support Node 12 HOT 2
- Fix compilation warnings with Node 12. HOT 1
- How should profiling interact with worker-threads? HOT 3
- Expose a profile to pprof CLI HOT 1
- Doesn't compile on windows HOT 4
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 pprof-nodejs.