88 Commits

Author SHA1 Message Date
Matteo Collina
9727c01f84 Escape __dirname before generating regexp 2018-10-19 15:22:14 +02:00
Ruben Bridgewater
52dfaee21c
Filter next tick
This also moves the main filter logic into the executed function.
This seemed cleaner instead of having to do this in the receiving
part.
2018-10-08 16:40:14 +02:00
Renée Kooi
c2c82e2d78
Friendlier api for ticksToTree 2018-09-26 15:14:04 +02:00
Renée Kooi
b815523ab7
lint fix 2018-09-26 15:02:50 +02:00
Ruben Bridgewater
13ea91156a
Detect esm modules init phase 2018-09-24 17:35:36 +02:00
Ruben Bridgewater
8fd20ca80f
Improve init detection
Some native frames could be detected as init phase which is wrong.
This fixes it by using a stricter core module detection.
2018-09-22 11:53:17 +02:00
Matteo Collina
40cb7c832e
Merge pull request #176 from BridgeAR/add-missing-files
Add missing files
2018-09-21 16:05:42 +02:00
Ruben Bridgewater
91407229b7
Add missing files 2018-09-21 16:03:23 +02:00
Ruben Bridgewater
b6c845f42e
Minor cleanup 2018-09-21 15:11:49 +02:00
Ruben Bridgewater
1b5b419191
Fix init detection
This makes sure the init phase is properly detected throughout all
Node.js versions.

A couple of mechanisms work together to achieve that:

1) Get the stack trace while starting Node.js and remove all those
   frames later on.
2) All native modules are detected while initializing and all frames
   before that one including it will also be marked as bootstrapping
   frames.
3) For Node.js 10 a few more stacks are detected by directly checking
   for the `internal/bootstrap.js` file. It would not show up in the
   other two mechanisms.
4) A check for `internalBinding` is in place since this code would
   only execute during native module loading.
5) An explicit check for `NativeModule` is in place since that is the
   name of the internal Node.js module loading to bootstrap core.

This makes sure that pretty much all loading is properly detected.

Besides this, this commit fixes another small bug when using the
`treeDebug` option in combination with the `mapFrames` option. Before
the arguments were not passed through properly.
2018-09-21 15:11:49 +02:00
Ruben Bridgewater
ce46db50e3
fixup 2018-09-19 18:58:54 +02:00
Matteo Collina
7d895ade8b Fixed support for Node 8.12.0. 2018-09-19 14:42:47 +02:00
Ruben Bridgewater
e885726a7f
Fix linting errors 2018-09-19 10:22:48 +02:00
Matteo Collina
0a5eb02a0e Revert "Merge pull request #165 from BridgeAR/filter-init"
This reverts commit be8e703b03ed86d0252d3a32399fef17a415a485, reversing
changes made to 2bbc814beeee89693f2a55764a5c41ce22d54a61.
2018-09-18 15:59:54 +02:00
Ruben Bridgewater
cedd18ce12
Remove trailing whitespace & remove extra line 2018-09-18 00:57:14 +02:00
Ruben Bridgewater
429efd057c
Make sure the same Node.js executable is used
So far the child process spawned to vizualize the data could be a
different one than the one used to run 0x. Now it's always the same
and there should be no mismatch left.

Fixes: #119
2018-09-18 00:57:14 +02:00
Matteo Collina
086213ec85
Merge pull request #166 from AlanSl/nested-output
Allow 0x to create output in a subfolder of a new folder
2018-09-12 15:31:26 +02:00
AlanSl
21ef815749 Replace all placeholders, not just first
For example, for output to `{pid}.clinic-flame/{pid}.clinic-flame-0x-data/`
2018-09-12 08:24:02 +01:00
AlanSl
963ddbed23 Remove trailing whitespace 2018-09-12 08:20:31 +01:00
AlanSl
f8241f6693 Allow output to subfolders of new folders
Handles folders that already exist and many more error cases than previously. 0x already has npm mkdirp as a dep-of-dep, but make-dir is actively maintained and appears much more robust.
2018-09-12 08:20:11 +01:00
Ruben Bridgewater
bb3ed048bc
Fix init phase detection
The detection will now rely on the `anonymous` function that is used
by node to wrap modules. The very first of such entries is detected
and all other entries must be init frames. This is reliable in a way
that further changes to Node.js internals in the init phase will not
have any impact on the detection.
2018-09-11 15:57:30 +02:00
Ruben Bridgewater
70af5b7c13
Minimal clean up 2018-09-11 15:43:46 +02:00
Ruben Bridgewater
b1bd95fadd
Remove trailing whitespace 2018-09-11 15:43:46 +02:00
Matteo Collina
a824b46307
Merge pull request #161 from BridgeAR/remove-unused-file
Remove unused file
2018-08-27 17:30:19 +02:00
Ruben Bridgewater
86349c85cd
Remove unused file 2018-08-27 16:29:28 +02:00
Renée Kooi
0fdd418274
Change process.stdout switcharoo to a full net.Socket instance
No matter how you write to stdout, this should catch it!
The `defineProperty` call uses the same options as the default `process.stdout`.
2018-08-24 13:25:11 +02:00
Renée Kooi
fb59f94773
Throw error if a cluster subprocess is forked
0x doesn't support it.

I used the 'fork' event because it's easier than intercepting `require`
and this way it allows requiring but not using `cluster`.
If the subprocess does `try { cluster.fork() }` this won't crash, but
that's probably fine? Same if the subprocess has an 'uncaughtException'
handler.

Ex:

```
➜  ./cmd.js cluster.js
🔥  Profiling/home/goto-bus-stop/Code/nearform/0x/lib/preload/no-cluster.js:4
  throw new Error('0x does not support clustering.')
  ^
Error: 0x does not support clustering.
    at EventEmitter.cluster.on (/home/goto-bus-stop/Code/nearform/0x/lib/preload/no-cluster.js:4:9)
    at EventEmitter.emit (events.js:182:13)
    at emitForkNT (internal/cluster/master.js:226:11)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
🚫  Target subprocess error, code: 1
```
2018-08-24 11:32:10 +02:00
Shuhei Kagawa
d14823d1d4 Remove duplicated JS from flamegraph.html
Fixes #147
2018-08-11 23:42:46 +02:00
Mathias Buus
afd1466a78 fix signalling on windows 2018-07-24 21:58:16 +02:00
Mathias Buus
bf90105026 "fix" validator 2018-07-17 15:44:12 +02:00
Mathias Buus
c94b8f346e allow onPort to be a function 2018-07-17 15:29:33 +02:00
davidmarkclements
4157fba026 ignore unknown code state errors, closes #125 2018-05-09 15:21:35 +02:00
Jamie Davis
85086fba21 Safely parse large trace stacks files
Problem:
If the file with trace stacks is larger than the maximum string length,
then traceStacksToTicks chokes on a call to toString.

Solution:
Split buffer on newlines via repeated indexOf rather than via
buf.toString.split('\n')

Test:
I ran assert.deepEqual to compare the stacks generated by the
old and new approaches. It said they were equivalent.

Fixes: #120
2018-04-17 17:22:07 -04:00
davidmarkclements
a27c3c9a49 improve init labelling 2018-04-03 16:07:50 +02:00
davidmarkclements
f64df5aa8b init labelling bugfix 2018-04-02 19:42:57 +02:00
davidmarkclements
cb3eaebb40 researching inlinable edge cases, update comment 2018-03-24 14:59:42 +01:00
davidmarkclements
c32c7a91dc improve inlinable capturing, now allows for other v8 to stdout, e.g. --trace-opt etc 2018-03-24 14:45:44 +01:00
davidmarkclements
1328569d67 remove instrumentation stacks 2018-03-21 11:25:09 +01:00
davidmarkclements
dffea76a2c update d3-fg 2018-03-21 04:13:35 +01:00
davidmarkclements
f4aa18f4e2 rm phases, include init tier 2018-03-21 03:37:09 +01:00
davidmarkclements
06ef99a115 kernel tracing ui and search fix 2018-03-20 17:27:33 +01:00
davidmarkclements
d21aae0211 preload dir 2018-03-20 17:16:04 +01:00
davidmarkclements
a3226f48b0 --on-port full impl 2018-03-20 16:52:43 +01:00
Mathias Buus
a1b9928b2c works-ish 2018-03-19 18:03:00 +01:00
davidmarkclements
9cc5b37de6 readme, ui fixes, api changes 2018-03-16 22:07:45 +01:00
davidmarkclements
1f1ddaf782 lint 2018-03-14 20:25:46 +01:00
davidmarkclements
2b725b4df1 improve error output from prof subproc 2018-03-14 20:25:27 +01:00
davidmarkclements
b8cd9f9092 expand flamegraph indicator 2018-03-14 11:21:26 +01:00
davidmarkclements
07e8b39ab3 linting 2018-03-14 01:48:58 +01:00
davidmarkclements
fbbae4470f ui improve, cli improve, final rearranging 2018-03-14 01:25:16 +01:00