{"_id":"event-loop-delay","_rev":"397952","name":"event-loop-delay","description":"A minimal overhead event loop delay sampler.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-08-04T04:20:44.000Z","created":"2019-01-03T10:53:14.295Z","1.0.1":"2019-11-18T15:58:45.543Z","1.0.0":"2019-01-03T11:06:59.650Z","0.0.0":"2019-01-03T10:53:14.295Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/event-loop-delay.git"},"versions":{"1.0.1":{"name":"event-loop-delay","version":"1.0.1","description":"A minimal overhead event loop delay sampler.","main":"index.js","dependencies":{"napi-macros":"^2.0.0","node-gyp-build":"^4.2.0"},"devDependencies":{"prebuildify":"^3.0.4"},"scripts":{"prebuild":"cd native && prebuildify --napi"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/event-loop-delay.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/event-loop-delay/issues"},"homepage":"https://github.com/mafintosh/event-loop-delay","gitHead":"7664c3e80047d69416ba894dc367ba4014798721","_id":"event-loop-delay@1.0.1","_nodeVersion":"12.13.0","_npmVersion":"6.12.1","dist":{"shasum":"c0e7e30a37e3ce77b1a179a23bee72cf34bcec9f","size":9143,"noattachment":false,"key":"/event-loop-delay/-/event-loop-delay-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/event-loop-delay/download/event-loop-delay-1.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-loop-delay_1.0.1_1574092725414_0.8774126278935479"},"_hasShrinkwrap":false,"publish_time":1574092725543,"_cnpm_publish_time":1574092725543},"1.0.0":{"name":"event-loop-delay","version":"1.0.0","description":"A minimal overhead event loop delay sampler.","main":"index.js","dependencies":{"napi-macros":"^1.8.2","node-gyp-build":"^3.7.0"},"devDependencies":{"prebuildify":"^2.10.0"},"scripts":{"prebuild":"cd native && prebuildify --napi"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/event-loop-delay.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/event-loop-delay/issues"},"homepage":"https://github.com/mafintosh/event-loop-delay","gitHead":"b3171216216e0134166c6c0599ecfa4f010213ec","_id":"event-loop-delay@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"5af6282549494fd0d868c499cbdd33e027978b8c","size":8701,"noattachment":false,"key":"/event-loop-delay/-/event-loop-delay-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/event-loop-delay/download/event-loop-delay-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-loop-delay_1.0.0_1546513619508_0.11012583960725753"},"_hasShrinkwrap":false,"publish_time":1546513619650,"_cnpm_publish_time":1546513619650},"0.0.0":{"name":"event-loop-delay","version":"0.0.0","description":"A minimal overhead event loop delay sampler.","main":"index.js","dependencies":{"napi-macros":"^1.8.2","node-gyp-build":"^3.7.0"},"devDependencies":{"prebuildify":"^2.10.0"},"scripts":{"prebuild":"cd native && prebuildify --napi"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/event-loop-delay.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/event-loop-delay/issues"},"homepage":"https://github.com/mafintosh/event-loop-delay","_id":"event-loop-delay@0.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"4e6e629e72a197ab33fdc02f3fc6b6ceef9e2425","size":6620,"noattachment":false,"key":"/event-loop-delay/-/event-loop-delay-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/event-loop-delay/download/event-loop-delay-0.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-loop-delay_0.0.0_1546512794187_0.19921760103993646"},"_hasShrinkwrap":false,"publish_time":1546512794295,"_cnpm_publish_time":1546512794295}},"readme":"# event-loop-delay\n\nA minimal overhead event loop delay sampler.\n\n```\nnpm install event-loop-delay\n```\n\nBundles a prebuilt N-API addon that makes the overhead of the sampler very minimal (around 0.2% on my machine, ymmv).\n\nIf the addon fails for some reason a JS fallback is used with a bit higher overhead (around 1-2% on my machine).\n\n## Usage\n\n``` js\nconst loopDelay = require('event-loop-delay')\n\nconst sampler = loopDelay()\n\nsetInterval(function () {\n  console.log('Accumulated delay in ms is', sampler.delay)\n  console.log('Accumulated times a delay was detected', sampler.times)\n}, 1000)\n\nsetInterval(function () {\n  for (let i = 0; i < 1e7; i++) {\n    // simulate event loop blocking\n  }\n}, 3000)\n```\n\nRunning the above should run the sampler measuring the event loop delay.\n\n## API\n\n#### `sampler = loopDelay()`\n\nMake a new sampler. Will sample the event loop every 10ms.\n\n#### `sampler.delay`\n\nAccumulated event loop delay in ms measured since sampler was created.\n\n#### `sampler.times`\n\nAccumulated times the event loop delay was detected.\n\n#### `sampler.destroy()`\n\nDestroys the sampler.\n\n#### `sampler.native`\n\nBoolean telling you if the native addon is used.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/event-loop-delay","bugs":{"url":"https://github.com/mafintosh/event-loop-delay/issues"},"license":"MIT"}