@@ -16,7 +16,7 @@ on any platform which Node runs on (macOs, Linux, Windows, Android...).
16
16
* Node v8.5.0 and above
17
17
* Default usage supports any Operating System that Node runs on!
18
18
* Chrome
19
- * Other browsers may open flamegraphs in a degraded, but functional form
19
+ * Other browsers may open flamegraphs in a degraded, but functional form
20
20
21
21
## Legacy
22
22
@@ -82,12 +82,12 @@ generates a profile folder (`<pid>.0x`), containing `flamegraph.html`.
82
82
83
83
## The UI
84
84
85
- The ` flamegraph.html ` file contains the 0x UI, which is explained in
85
+ The ` flamegraph.html ` file contains the 0x UI, which is explained in
86
86
[ docs/ui.md] ( docs/ui.md ) .
87
87
88
88
## Production Servers
89
89
90
- A lightweight, production server friendly, approach to generating a
90
+ A lightweight, production server friendly, approach to generating a
91
91
flamegraph is described in [ docs/production-servers.md] ( docs/production-servers.md ) .
92
92
93
93
## The Profile Folder
@@ -125,90 +125,90 @@ Print usage info.
125
125
Open the flamegraph in the browser using ` open ` or ` xdg-open ` (see
126
126
https://www.npmjs.com/package/open for details).
127
127
128
- ### --on-port | -P
128
+ ### --on-port | -P
129
129
130
- Run a given command and then generate the flamegraph.
131
- The command as specified has access to a ` $PORT ` variable.
132
- The ` $PORT ` variable is set according to the first port that
133
- profiled process opens.
130
+ Run a given command and then generate the flamegraph.
131
+ The command as specified has access to a ` $PORT ` variable.
132
+ The ` $PORT ` variable is set according to the first port that
133
+ profiled process opens.
134
134
135
- For instance, here's an example of using [ autocannon] ( http://npm.im/autocannon )
135
+ For instance, here's an example of using [ autocannon] ( http://npm.im/autocannon )
136
136
to load-test the process:
137
137
138
138
``` sh
139
139
0x -P ' autocannon localhost:$PORT' app.js
140
140
```
141
141
142
- When the load-test completes, the profiled processed will be
143
- sent a SIGINT and the flamegraph will be automatically generated.
142
+ When the load-test completes, the profiled processed will be
143
+ sent a SIGINT and the flamegraph will be automatically generated.
144
144
145
145
Remember to use single quotes to avoid bash interpolation,
146
146
or else escape variable (e.g. ` 0x -P "autocannon localhost:$PORT" app.js `
147
147
won't work wheras ` 0x -P "autocannon localhost:\$PORT" app.js ` will).
148
148
149
149
Note: On Windows interpolation usually occurs with ` %PORT% ` , however
150
- in this case the dollar-prefix ` $PORT ` is the correct syntax
151
- (because the interpolation is not shell based).
150
+ in this case the dollar-prefix ` $PORT ` is the correct syntax
151
+ (because the interpolation is not shell based).
152
152
153
153
Default: ''
154
154
155
155
### --name
156
156
157
157
The name of the HTML file, without the .html extension
158
158
Can be set to - to write HTML to STDOUT (note
159
- due to the nature of CLI argument parsing, this must be set using ` = ` ,
159
+ due to the nature of CLI argument parsing, this must be set using ` = ` ,
160
160
e.g. ` --name=- ` ).
161
161
162
- If either this flag or ` --output-html-file ` is set to ` - `
162
+ If either this flag or ` --output-html-file ` is set to ` - `
163
163
then the HTML will go to STDOUT.
164
164
165
165
Default: flamegraph
166
166
167
- ### ---title
167
+ ### ---title
168
168
169
169
Set the title to display in the flamegraph UI.
170
170
171
- Default: the command that 0x ran to start the process
171
+ Default: the command that 0x ran to start the process
172
172
173
173
### --output-dir | -D
174
174
175
175
Specify artifact output directory. This can be specified in template
176
- form with possible variables being ` {pid} ` , ` {timestamp} ` , ` {name} `
176
+ form with possible variables being ` {pid} ` , ` {timestamp} ` , ` {name} `
177
177
(based on the ` --name ` flag) and ` {outputDir} ` (variables
178
178
must be specified without whitespace, e.g. ` { pid } ` is not supported).
179
179
180
180
Default: ` {pid}.0x `
181
181
182
182
### --output-html | -F
183
183
184
- Specify destination of the generated flamegraph HTML file.
185
- This can be specified in template form with possible variables
186
- being ` {pid} ` , ` {timestamp} ` , ` {name} ` (based on the ` --name ` flag) and
187
- ` {outputDir} ` (variables must be specified without whitespace,
188
- e.g. ` { pid } ` is not supported). It can also be set to ` - ` to
184
+ Specify destination of the generated flamegraph HTML file.
185
+ This can be specified in template form with possible variables
186
+ being ` {pid} ` , ` {timestamp} ` , ` {name} ` (based on the ` --name ` flag) and
187
+ ` {outputDir} ` (variables must be specified without whitespace,
188
+ e.g. ` { pid } ` is not supported). It can also be set to ` - ` to
189
189
send the HTML output to STDOUT (note
190
- due to the nature of CLI argument parsing, this must be set using ` = ` ,
190
+ due to the nature of CLI argument parsing, this must be set using ` = ` ,
191
191
e.g. ` --output-html=- ` ).
192
192
193
- If either this flag or ` --name ` is set to ` - `
193
+ If either this flag or ` --name ` is set to ` - `
194
194
then the HTML will go to STDOUT.
195
195
196
196
Default: ` {outputDir}/{name}.html `
197
197
198
198
### --kernel-tracing
199
199
200
- Use an OS kernel tracing tool (perf on Linux or
201
- dtrace on macOS and SmartOS). This will capture
202
- native stack frames (C++ modules and Libuv I/O),
200
+ Use an OS kernel tracing tool (perf on Linux or
201
+ dtrace on macOS and SmartOS). This will capture
202
+ native stack frames (C++ modules and Libuv I/O),
203
203
but may result in missing stacks on Node 8.
204
204
205
205
See [ docs/kernel-tracing.md] ( docs/kernel-tracing.md ) for more information.
206
206
207
- Default: false
207
+ Default: false
208
208
209
- ### --quiet | -q
209
+ ### --quiet | -q
210
210
211
- Limit output, the only output will be fatal errors or
211
+ Limit output, the only output will be fatal errors or
212
212
the path to the ` flamegraph.html ` upon successful generation.
213
213
214
214
Default: false
@@ -226,9 +226,9 @@ with relevant outputs.
226
226
227
227
Default: false
228
228
229
- ### --visualize-only
229
+ ### --visualize-only
230
230
231
- Supply a path to a profile folder to build or rebuild visualization
231
+ Supply a path to a profile folder to build or rebuild visualization
232
232
from original stacks.
233
233
234
234
Default: undefined
@@ -246,7 +246,7 @@ file.
246
246
247
247
Default: false
248
248
249
- ## Programmatic API
249
+ ## Programmatic API
250
250
251
251
0x can also be required as a Node module and scripted:
252
252
@@ -268,6 +268,7 @@ async function capture () {
268
268
}
269
269
270
270
capture ()
271
+
271
272
```
272
273
273
274
The Programmatic API is detailed in [ docs/api.md] ( docs/api.md ) .
@@ -276,9 +277,9 @@ The Programmatic API is detailed in [docs/api.md](docs/api.md).
276
277
277
278
### Memory Issues
278
279
279
- Very complex applications with lots of stacks may hit memory issues.
280
+ Very complex applications with lots of stacks may hit memory issues.
280
281
281
- The ` --stack-size ` flag can be used to set the memory to the maximum 8GB
282
+ The ` --stack-size ` flag can be used to set the memory to the maximum 8GB
282
283
in order to work around this when profiling:
283
284
284
285
```
@@ -287,7 +288,7 @@ node --stack-size=8024 $(which 0x) my-app.js
287
288
288
289
There may still be a problem opening the flamegraph in Chrome. The same work
289
290
around can be used by opening Chrome from the command line (platform dependent)
290
- and nesting the ` --stack-size ` flag within the ` --js-flags ` flag:
291
+ and nesting the ` --stack-size ` flag within the ` --js-flags ` flag:
291
292
` --js-flags="--stack-size 8024" ` .
292
293
293
294
## Debugging
@@ -305,7 +306,7 @@ and nesting the `--stack-size` flag within the `--js-flags` flag:
305
306
Sponsored by [ nearForm] ( http://nearform.com )
306
307
307
308
This tool is inspired from various info and code sources
308
- and would have taken much longer without the following people and
309
+ and would have taken much longer without the following people and
309
310
their Open Source/Info Sharing efforts:
310
311
311
312
* Thorsten Lorenz (< http://thlorenz.com/ > )
0 commit comments