Comparing version 1.0.4 to 1.0.5
The MIT License (MIT) | ||
Copyright (c) 2016 David Mark Clements & Matteo Collina | ||
Copyright (c) 2014-2015 Thorsten Lorenz (Regular Expressions) | ||
Copyright (c) 2014-2015 Thorsten Lorenz (Regular Expressions and profile_1ms.d) | ||
@@ -9,2 +9,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "perf-sym", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Translate symbol names generated by `--basic-perf-prof` into JavaScript names", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# perf-sym | ||
Translate symbol names generated by `--basic-perf-prof` into JavaScript names | ||
Translate symbol names generated by `--basic-perf-prof` into JavaScript names. | ||
__You can use this tool to generate Flamegraphs on OSX and Linux__. | ||
@@ -8,3 +9,3 @@ ## Install | ||
```sh | ||
[sudo] npm i -g perf-sym | ||
[sudo] npm i -g perf-sym stackvis | ||
``` | ||
@@ -29,2 +30,25 @@ | ||
### Instrument your code | ||
Your process needs to shut down properly to generate the symbol map, so | ||
instrument it with: | ||
```js | ||
console.error('process.pid', process.pid) | ||
// Cleanly shut down process on SIGINT to ensure that perf-<pid>.map gets flushed | ||
process.on('SIGINT', onSIGINT) | ||
function onSIGINT () { | ||
// IMPORTANT to log on stderr, to not clutter stdout which is purely for data, i.e. dtrace stacks | ||
console.error('Caught SIGINT, shutting down.') | ||
// close any servers you have opened | ||
server.close() | ||
// clean exit | ||
process.exit(0) | ||
} | ||
``` | ||
### OS X | ||
@@ -34,19 +58,28 @@ | ||
```sh | ||
[sudo] npm install -g stackvis | ||
Run your application, in one terminal: | ||
``` | ||
node --perf-basic-prof index.js | ||
# this should emit the PID of the process to stdout | ||
``` | ||
In another terminal, run: | ||
``` | ||
node --perf-basic-prof index.js & | ||
sudo profile_1ms.d -p YOURPID > stacks.out | ||
``` | ||
export PID=$! | ||
In another terminal, run a load/soak test: | ||
(sudo profile_1ms.d -p $PID > stacks.out; kill -s INT $PID) & | ||
``` | ||
wrk -c 100 -d 10 http://localhost:3000 | ||
``` | ||
npm test | ||
When the load/soak test is finished, hit `CRL-C` in the terminal running | ||
your application. | ||
sudo killall dtrace | ||
now run: | ||
cat stacks.out | perf-sym -r initial --no-sys $PID | stackvis perf > flamegraph.html | ||
``` | ||
cat stacks.out | perf-sym --no-sys YOURPID | stackvis perf > flamegraph.html | ||
open flamegraph.html | ||
@@ -59,19 +92,27 @@ ``` | ||
```sh | ||
[sudo] npm install -g stackvis | ||
Run your application, in one terminal: | ||
``` | ||
node --perf-basic-prof index.js | ||
# this should emit the PID of the process to stdout | ||
``` | ||
In another terminal, run: | ||
``` | ||
node --perf-basic-prof index.js & | ||
perf record -p YOURPID -i -g -e cycles:u; perf script > stacks.out | ||
``` | ||
export PID=$! | ||
In another terminal, run a load/soak test: | ||
(perf record -p $PID -i -g -e cycles:u; perf script > stacks.out; kill -s INT $PID) & | ||
``` | ||
wrk -c 100 -d 10 http://localhost:3000 | ||
``` | ||
npm test | ||
When the load/soak test is finished, hit `CRL-C` in the terminal running | ||
your application. | ||
killall perf; killall perf | ||
now run: | ||
cat stacks.out | perf-sym -r initial --no-sys $PID | stackvis perf > flamegraph.html | ||
``` | ||
cat stacks.out | perf-sym --no-sys YOURPID | stackvis perf > flamegraph.html | ||
@@ -93,2 +134,2 @@ open flamegraph.html | ||
MIT | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8839
131
1