cluster: make --prof work for workers
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 18 Jan 2013 11:44:10 +0000 (12:44 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 18 Jan 2013 11:56:40 +0000 (12:56 +0100)
commit6b713b52537f2509e79fcb4d4f9433db1aee2dd9
tree774934f545a45c0ecb992a5650fcc6038c51eba6
parent8b0f3ce397b473ab6c438aa9c002f38396713e44
cluster: make --prof work for workers

Profiling in clustered environments doesn't work out of the box.

By default, V8 writes the profile data of all processes to a single
v8.log.

Running that log file through a tick processor produces bogus numbers
because many events won't match up with the recorded memory mappings
and you end up with graphs where 80+% of ticks is unaccounted for.

Fixing the tick processor to deal with multi-process output is not very
useful because the processes may be running wildly disparate workloads.

That's why we fix up the command line arguments to include
a "--logfile=v8-%p.log" argument (where %p is expanded to the PID)
unless it already contains a --logfile argument.

Fixes #4617.
lib/cluster.js