Giter Site home page Giter Site logo

node-gcstats's Introduction

NB!

V1.4.0 was using s3 for prebuilt binaries that is not associated with project anymore use v1.4.0 at your own risk

GCStats

Build Status Build status

Exposes stats about V8 GC after it has been executed.

Usage

Create a new instance of the module and subscribe to stats-events from that:

var gc = (require('gc-stats'))();

gc.on('stats', function (stats) {
    console.log('GC happened', stats);
});

This will print blobs like this whenever a GC happened:

GC happened {
  startTime: 9426055813976,
  endTime: 9426057735390,
  pause: 1921414,
  pauseMS: 1,
  gctype: 1,
  before: {
     totalHeapSize: 11354112,
     totalHeapExecutableSize: 3670016,
     usedHeapSize: 7457184,
     heapSizeLimit: 1501560832,
     totalPhysicalSize: 9725880,
     totalAvailableSize: 1488434544,
     mallocedMemory: 8192,
     peakMallocedMemory: 1186040
  },
  after: {
     totalHeapSize: 12402688,
     totalHeapExecutableSize: 3670016,
     usedHeapSize: 6485792,
     heapSizeLimit: 1501560832,
     totalPhysicalSize: 10166144,
     totalAvailableSize: 1489388528,
     mallocedMemory: 8192,
     peakMallocedMemory: 1186040
  },
  diff: {
     totalHeapSize: 1048576,
     totalHeapExecutableSize: 0,
     usedHeapSize: -971392,
     heapSizeLimit: 0,
     totalPhysicalSize: 440264,
     totalAvailableSize: 953984,
     mallocedMemory: 0,
     peakMallocedMemory: 0
  }
}

Property insights

  • totalHeapSize: Number of bytes V8 has allocated for the heap. This can grow if usedHeap needs more.
  • usedHeapSize: Number of bytes in use by application data
  • total HeapExecutableSize: Number of bytes for compiled bytecode and JITed code
  • heapSizeLimit: The absolute limit the heap cannot exceed
  • totalPhysicalSize: Committed size (node 0.11+)
  • totalAvailableSize: Available heap size(node 4+)
  • startTime: Nanoseconds for start, using hrtime()
  • endTime: Nanoseconds for end, using hrtime()
  • pause: Nanoseconds from start to end of GC using hrtime()
  • pauseMS: pause expressed in milliseconds
  • mallocedMemory
  • peakMallocedMemory
  • numberOfNativeContexts
  • numberOfDetachedContexts
  • gctype can have the following values(v8 source):
    • 1: Scavenge (minor GC)
    • 2: Mark/Sweep/Compact (major GC)
    • 4: Incremental marking
    • 8: Weak/Phantom callback processing
    • 15: All

Installation

npm install gc-stats

Node version support

node-gcstats depends on C++ extensions which are compiled when the gc-stats module is installed. Compatibility information can be inspected via the Travis-CI build jobs.

node-gcstats's People

Contributors

advait avatar andreasmadsen avatar andrewdeandrade avatar bluelovers avatar bripkens avatar dainis avatar fernandopasik avatar kkoopa avatar megastef avatar mendenajdov avatar msiebuhr avatar roikoren755 avatar rragan avatar yelworc avatar yvasiyarov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-gcstats's Issues

Linux pre-built binaries

I'm using node 13, and cannot find pre-built binaries for this version on linux. Saw that the .travis.yml file doesn't test with that version, but on the other hand I don't see any Travis jobs related to this repo.

I created a PR to add node 13 to the Travis CI, is it relevant at all?

Fails to build on Node 10.2.x

It looks like this build fails with node 10.2.0 (which had issues with native modules) and 10.2.1 (where the issues should have been fixed).

From package.json:

  "dependencies": {
    "gc-stats": "^1.1.1",

Log:

❯ node --version
v10.2.1

❯ npm install        

> [email protected] install /Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-binaries.s3.amazonaws.com/gcstats/v1.1.1/Release/node-v64-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Hit error Connection closed while downloading tarball file 
  CXX(target) Release/obj.target/gcstats/src/gcstats.o
  CXX(target) Release/obj.target/gcstats/src/gcstats.o
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:839:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:854:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:164:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:869:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:157:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:839:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:854:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:164:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:869:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:157:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:1648:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/gcstats.cc:1:
../../nan/nan.h:1648:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:171:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/jmorrell/.node-gyp/10.2.1/include/node/node.h:88:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
../src/gcstats.cc:136:19: warning: 'Call' is deprecated [-Wdeprecated-declarations]
        afterGCCallback->Call(1, arguments);
                         ^
../../nan/nan.h:1567:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/gcstats.cc:136:19: warning: 'Call' is deprecated [-Wdeprecated-declarations]
        afterGCCallback->Call(1, arguments);
                         ^
../../nan/nan.h:1567:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
5 warnings generated.
5 warnings generated.
rm: ./Release/.deps/Release/obj.target/gcstats/src/gcstats.o.d.raw: No such file or directory
make: *** [Release/obj.target/gcstats/src/gcstats.o] Error 1
gyp  SOLINK_MODULE(target) Release/gcstats.node
 ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/jmorrell/.nvm/versions/node/v10.2.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/Users/jmorrell/.nvm/versions/node/v10.2.1/bin/node" "/Users/jmorrell/.nvm/versions/node/v10.2.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/build/gcstats/v1.1.1/Release/node-v64-darwin-x64/gcstats.node" "--module_name=gcstats" "--module_path=/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/build/gcstats/v1.1.1/Release/node-v64-darwin-x64"
gyp ERR! cwd /Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats
gyp ERR! node -v v10.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/jmorrell/.nvm/versions/node/v10.2.1/bin/node /Users/jmorrell/.nvm/versions/node/v10.2.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/build/gcstats/v1.1.1/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/build/gcstats/v1.1.1/Release/node-v64-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/Users/jmorrell/.nvm/versions/node/v10.2.1/bin/node" "/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats
node-pre-gyp ERR! node -v v10.2.1
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok 
Failed to execute '/Users/jmorrell/.nvm/versions/node/v10.2.1/bin/node /Users/jmorrell/.nvm/versions/node/v10.2.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/build/gcstats/v1.1.1/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/build/gcstats/v1.1.1/Release/node-v64-darwin-x64' (1)
  COPY /Users/jmorrell/workspace/heroku-nodejs-metrics-buildpack/node-metrics-plugin/node_modules/gc-stats/build/gcstats/v1.1.1/Release/node-v64-darwin-x64/gcstats.node
  TOUCH Release/obj.target/action_after_build.stamp
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Fails to build on node 12.x

Hello,
I've made pull request with small changes in example.js and CI checks tells me that module fails to compile on Node 12.x

Obviously it can not be caused by example.js, so its looks like master is broken. It might be related with #36 issue.

node-pre-gyp package deprecated

Installing ipfs :

warning ipfs > ipfs-cli > ipfs-daemon > prometheus-gc-stats > gc-stats > [email protected]: Please upgrade to
 @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will 
recieve updates in the future
  • O.S. : Ubuntu 18.04 Desktop
  • node: v14.5.0

License

Hi,

I'm using your module in a project of ours, node-oom-heapdump, which is distributed under MIT license. Do you have any issues with that, as gc-stats is licensed under Unlicense?

Thanks and keep up the good work.

Publish 1.5.0

It seems that v1.5.0 wasn't published to NPM, even though a commit was made to master with [publish npm] in the name of the commit.

Can you please publish this new version?

Security: Prototype pollution attack

┌────────────┬────────────────────────────────────────────────────────────────────┐
│            │ Prototype pollution attack                                         │
├────────────┼────────────────────────────────────────────────────────────────────┤
│ Name       │ hoek                                                               │
├────────────┼────────────────────────────────────────────────────────────────────┤
│ CVSS       │ 4 (Medium)                                                         │
├────────────┼────────────────────────────────────────────────────────────────────┤
│ Installed  │ 2.16.3                                                             │
├────────────┼────────────────────────────────────────────────────────────────────┤
│ Vulnerable │ <= 4.2.0 || >= 5.0.0 < 5.0.3                                       │
├────────────┼────────────────────────────────────────────────────────────────────┤
│ Patched    │ > 4.2.0 < 5.0.0 || >= 5.0.3                                        │
├────────────┼────────────────────────────────────────────────────────────────────┤
│ Path       │ [email protected] > [email protected] >                             │
│            │ [email protected] > [email protected]                                           │
├────────────┼────────────────────────────────────────────────────────────────────┤
│ More Info  │ https://nodesecurity.io/advisories/566                             │
└────────────┴────────────────────────────────────────────────────────────────────┘

Fails to build with node>=v0.11.4

Hello,

this issue handler is a bit deserted, but I just found a bug, got no place to report to, so I'll just report it here.

Cluster2 fails to build because of this error, see the error description here:
cubejs/cluster2#83

License

How is this project licensed? Would you mind adding one to the repo so other people can use it? Thanks!

won't build for armv8

is this repo designed to build for armv8? If so looks like I am missing a python module called 'ast'

not a python guru.. If that's the fix how do I get that loaded. It was apparently already on my dev 86 box so it must in some python dev library.

They say it's a standard library so maybe this arm box never got all of python installed.

https://docs.python.org/3/library/ast.html

> [email protected] install /opt/lights/controller/node_modules/gc-stats
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(403): https://node-binaries.s3.amazonaws.com/gcstats/v1.4.0/Release/node-v83-linux-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, glibc) (falling back to source compile with node-gyp) 
Traceback (most recent call last):
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 47, in <module>
    import gyp
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 10, in <module>
    import gyp.input
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 7, in <module>
    import ast
ImportError: No module named ast
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.49-rockchip64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/opt/lights/controller/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v83-linux-arm64/gcstats.node" "--module_name=gcstats" "--module_path=/opt/lights/controller/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v83-linux-arm64" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /opt/lights/controller/node_modules/gc-stats
gyp ERR! node -v v14.6.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/opt/lights/controller/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v83-linux-arm64/gcstats.node --module_name=gcstats --module_path=/opt/lights/controller/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v83-linux-arm64 --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/opt/lights/controller/node_modules/gc-stats/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1051:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 5.4.49-rockchip64
node-pre-gyp ERR! command "/usr/bin/node" "/opt/lights/controller/node_modules/gc-stats/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /opt/lights/controller/node_modules/gc-stats
node-pre-gyp ERR! node -v v14.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/opt/lights/controller/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v83-linux-arm64/gcstats.node --module_name=gcstats --module_path=/opt/lights/controller/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v83-linux-arm64 --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)

Not able to install package with npm version `2`

system npm-test › npm i gc-stats
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
/
> [email protected] install /Users/xxx/Projects/npm-test/node_modules/gc-stats
> node-pre-gyp install --fallback-to-build

module.js:327
    throw err;
    ^

Error: Cannot find module 'nopt'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/justinbeaudry/Projects/npm-test/node_modules/gc-stats/node_modules/node-pre-gyp/lib/node-pre-gyp.js:14:12)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/xxx/.nvm/versions/node/v4.8.0/bin/node" "/Users/xxx/.nvm/versions/node/v4.8.0/bin/npm" "i" "gc-stats"
npm ERR! node v4.8.0
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the gc-stats package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs gc-stats
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls gc-stats
npm ERR! There is likely additional logging output above.

v1.4.0 prebuilt binary s3 bucket is not associated with the project

version 1.4.0 was using node-pre-gyp for prebuilt binaries

after recent s3 charge attacks(running list and head requests against bucket that has result in 300+usd total charges across multiple months) I am dropping ownership of said s3 bucket

use v1.4.0 at your own risk

gctype 8

Hi, why i have a 8 value in gctype?

{
  "after": {
    "heapSizeLimit": 1535115264 ,
    "totalHeapExecutableSize": 10485760 ,
    "totalHeapSize": 75571232 ,
    "totalPhysicalSize": 74610168 ,
    "usedHeapSize": 38648328
  } ,
  "before": {
    "heapSizeLimit": 1535115264 ,
    "totalHeapExecutableSize": 10485760 ,
    "totalHeapSize": 75571232 ,
    "totalPhysicalSize": 74610168 ,
    "usedHeapSize": 38648328
  } ,
  "diff": {
    "heapSizeLimit": 0 ,
    "totalHeapExecutableSize": 0 ,
    "totalHeapSize": 0 ,
    "totalPhysicalSize": 0 ,
    "usedHeapSize": 0
  } ,
  "gctype": 8 ,
  "pause": 33191 ,
  "pauseMS": 0
}

regards.

Node 10 problem with yarn workspaces and lerna monorepo

When adding the dependency in one of the packages inside the monorepo I get a big error log from node-gyp.

~/Sites/myproject/packages/subpackage$ yarn add gc-stats

yarn add v1.10.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
[-/4] ⡀ waiting...
[2/4] ⡀ gc-stats
[-/4] ⡀ waiting...
error /Users/myuser/Sites/myproject/node_modules/gc-stats: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /Users/myuser/Sites/myproject/node_modules/gc-stats
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node" (not found)
node-pre-gyp http GET https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp http 403 https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp WARN Tried to download(403): https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://node-binaries.s3.amazonaws.com/gcstats/v1.2.0/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info ok
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/myuser/Sites/myproject/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/Sites/myproject/node_modules/gc-stats/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/Sites/myproject/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/.node-gyp/10.11.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/myuser/.node-gyp/10.11.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/myuser/Sites/myproject/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/myuser/.node-gyp/10.11.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/myuser/Sites/myproject/node_modules/gc-stats',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp infogyp spawn args   '--no-parallel',
 gyp infoinfo  spawn args   '--generator-output',
spawngyp  /usr/bin/python
info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn args [ '/Users/myuser/Sites/myproject/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/Sites/myproject/node_modules/gc-stats/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/Sites/myproject/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/.node-gyp/10.11.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/myuser/.node-gyp/10.11.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/myuser/Sites/myproject/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/myuser/.node-gyp/10.11.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/myuser/Sites/myproject/node_modules/gc-stats',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gypgyp info info  okok

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/gcstats/src/gcstats.o
  CXX(target) Release/obj.target/gcstats/src/gcstats.o
rm: ./Release/.deps/Release/obj.target/gcstats/src/gcstats.o.d.raw: No such file or directory
make: *** [Release/obj.target/gcstats/src/gcstats.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/myuser/Sites/myproject/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.7.0
  SOLINK_MODULE(target) Release/gcstats.node
gyp ERR! command "/Users/myuser/.nvm/versions/node/v10.11.0/bin/node" "/Users/myuser/Sites/myproject/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node" "--module_name=gcstats" "--module_path=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/myuser/Sites/myproject/node_modules/gc-stats
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/myuser/.nvm/versions/node/v10.11.0/bin/node /Users/myuser/Sites/myproject/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/myuser/Sites/myproject/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/Users/myuser/.nvm/versions/node/v10.11.0/bin/node" "/Users/myuser/Sites/myproject/node_modules/gc-stats/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/myuser/Sites/myproject/node_modules/gc-stats
node-pre-gyp ERR! node -v v10.11.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/Users/myuser/.nvm/versions/node/v10.11.0/bin/node /Users/myuser/Sites/myproject/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
  COPY /Users/myuser/Sites/myproject/node_modules/gc-stats/build/gcstats/v1.2.0/Release/node-v64-darwin-x64/gcstats.node

Missing pre-build binaries for all versions but 1.5.0

Currently I experience missing pre-build binaries for all version except latest 1.5.0,
e.g. https://node-binaries.s3.amazonaws.com/gcstats/v1.4.0/Release/node-v83-linux-x64.tar.gz responses with 403 HTTP code.

Assertion failure while changing priority of worker thread during GC

Doing this causes occasional assertion failures deep inside v8:

  var gc = (require('gc-stats'))();
  gc.on('stats', function (stats) {
    console.log('GC ' +
      ((stats.gctype&1) ? 'scavenge ' : '') +
      ((stats.gctype&2) ? 'marksweepcompact ' : '') +
      ((stats.gctype&4) ? 'incrementalmarking ' : '') +
      ((stats.gctype&8) ? 'weakcallbacks ' : '') +
      ((stats.gctype&0xfffffff0) ? ('0x' + stats.gctype.toString(16) + ' ') : '') +
      (stats.pause/1000000.0).toFixed(1) + 'mS ' +
      (stats.diff.usedHeapSize/1048576).toFixed(1) + 'M ' +
      (stats.after.usedHeapSize/1048576).toFixed(1) + 'M');
  });
  • Version:
    Node v8.1.0
  • Platform:
    Linux london 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

I get the following assertion failure:

node: tpp.c:84: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)' failed.

and gdb gives this backtrace:

Thread 5 "V8 WorkerThread" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff5340700 (LWP 20368)]
0x00007ffff6b79428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff6b79428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007ffff6b7b02a in __GI_abort () at abort.c:89
#2  0x00007ffff6b71bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7ffff6f20598 "new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)",
    file=file@entry=0x7ffff6f2058c "tpp.c", line=line@entry=84, function=function@entry=0x7ffff6f20650 <__PRETTY_FUNCTION__.7703> "__pthread_tpp_change_priority") at assert.c:92
#3  0x00007ffff6b71c82 in __GI___assert_fail (assertion=assertion@entry=0x7ffff6f20598 "new_prio == -1 || (new_prio >= fifo_min_prio && new_prio <= fifo_max_prio)",
    file=file@entry=0x7ffff6f2058c "tpp.c", line=line@entry=84, function=function@entry=0x7ffff6f20650 <__PRETTY_FUNCTION__.7703> "__pthread_tpp_change_priority") at assert.c:101
#4  0x00007ffff6f1f029 in __pthread_tpp_change_priority (previous_prio=previous_prio@entry=-1, new_prio=new_prio@entry=0) at tpp.c:82
#5  0x00007ffff6f1687c in __pthread_mutex_lock_full (mutex=0xe19ec80) at ../nptl/pthread_mutex_lock.c:456
#6  0x0000000000f11b7f in v8::internal::MemoryChunk::ReleaseTypedOldToOldSlots() ()
#7  0x0000000000ef3422 in v8::internal::PageParallelJob<v8::internal::PointerUpdateJobTraits<(v8::internal::PointerDirection)0> >::Task::RunInternal() ()
#8  0x0000000000b7130d in v8::internal::CancelableTask::Run() ()
#9  0x000000000148a479 in v8::platform::WorkerThread::Run() ()
#10 0x00000000016136a0 in ?? ()
#11 0x00007ffff6f146ba in start_thread (arg=0x7ffff5340700) at pthread_create.c:333
#12 0x00007ffff6c4a82d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

MemoryChunk::ReleaseTypedOldToOldSlots() references a base::AtomicValue<TypedSlotSet*>, which is why pthread_mutex gets involved.

I believe the root cause is calling uv_queue_work from the GC callback. uv_queue_work isn't safe to use from outside the main thread. You really want the uv_async system, which is intended for triggering work from a non-main thread (like the GC thread) and having it executed on the main thread.

Support Node 12

Please add support for Node 12. My Travis test fails.
On my dev machine, I updated node-pre-gyp to [email protected] and then gc-stats was compiled.

Which property should I use to measure memory leak

Thanks for this great module. I am trying to apply this module to detect memory leak by measuring memory growth after GC runs. Which of the properties available is most optimal to watch in an attempt to detect memory leaks?

Thx

pauseMS is truncated instead of rounded

This is visible even from the project README, where 1920 msec are formatted as pauseMS: 1

It happens because of that line:

Nan::New<Number>(static_cast<double>((data->gcEndTime - data->gcStartTime) / 1000000)));
in which the result of the division by 1E6 is cast to a float after the division, but the C/C++ division of two integers yelds a truncated integer, not a rounded one.

One of the arguments at least should be cast before the division and the result then rounded to the closest integer.

npm audit vulnerabilities

┌──────────────────────────────────────────────────────────────────────────────┐
│                                Manual Review                                 │
│            Some vulnerabilities require your attention to resolve            │
│                                                                              │
│         Visit https://go.npm.me/audit-guide for additional guidance          │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ minimist                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.2.1 <1.0.0 || >=1.2.3                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gc-stats                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gc-stats > node-pre-gyp > mkdirp > minimist                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1179                            │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ minimist                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.2.1 <1.0.0 || >=1.2.3                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gc-stats                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gc-stats > node-pre-gyp > tar > mkdirp > minimist            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1179                            │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ minimist                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.2.1 <1.0.0 || >=1.2.3                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gc-stats                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gc-stats > node-pre-gyp > rc > minimist                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/1179                            │
└───────────────┴──────────────────────────────────────────────────────────────┘

Error: Cannot find module /gc-stats/build/gcstats/v1.4.0/Release/node-v83-darwin-x64/gcstats.node

node -v
v14.16.0
npm install - OK
npm run start
Error: Cannot find module '/Users/~/node_modules/gc-stats/build/gcstats/v1.4.0/Release/node-v83-darwin-x64/gcstats.node'
Require stack:

  • /Users/~/node_modules/gc-stats/index.js
  • /Users//Health.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (/Users/i
    /node_modules/gc-stats/index.js:7:13)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.

stdio

Why do you need stdio.h? It seems to run fine without it.

THIS REPOSITORY IS ABANDONED

This repo/npm module have been abandoned by the maintainer. At this time (Sept. 10, 2021) there are a number of forks out there but no one has publicly stepped up to commit to owning this codebase moving forward.

Licensing

Is node-gcstats deliberately unlicensed? Would you be willing to release it under an open source license?

io.js 2.0 support.

nan dependency should be updated to ~1.8.0.
Or to ^1.7.0 or ^1.8.0 if you don't want to update package.json with every new minor version of nan.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.