-
Notifications
You must be signed in to change notification settings - Fork 340
CPU Profiling #8
Comments
Perhaps one can do this using the profile provider from Windows DTrace? https://github.com/prash-wghats/DTrace-win32 For Linux perf_events, if frame pointers work, then it's just a matter of dumping a /tmp/perf-PID.map file for the symbol lookups (http://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html). |
Chakra registers js stack frames with ETW, so you can use any tool which reads this. I would recommend using tools WPR and WPA (included in the Windows SDK). It has a bit of a learning curve, but is very powerful! |
Chakra do register js stack frames, but Chakracore doesn't. So if you want to get profiling information, you might need node+chakra that runs with |
@kunalspathak Ah didn't realize this isn't supported in ChakraCore. I've opened chakra-core/ChakraCore#328 to discuss possibility of adding this. |
Chakra returns JsErrorOutOfMemory error code that shim ignores and doesn't propagate to the user. Added jsrt helper SetOutOfMemoryErrorIfExist that will check for the error code JsErrorOutOfMemory after function call, running and parsing script. If this error code was returned, then set the exception on the context which will be verified by subsequent try_catch. Reviewed-By: jianchun Fix nodejs#8
@kunalspathak we should revisit this issue now that ChakraCore has ETW support. |
I will play around with this when i get chance and update this issue with the instructions on how to use it. Note that this will not be usable until we bring ETW change into nodejs/chakracore-master. |
Windows has support for this and @MSLaguana is looking into adding support for Linux. |
Node-chakracore now has support for JITted frames in ETW on windows, and using the linux |
@MSLaguana This is great! Thanks so much for adding this, Chakra is definitely a step ahead of the competition when it comes to CPU profiling. Is it possible to provide a default signal and make this part of the default distribution of Chakra? This would then enable CPU profiling right out of the box for everyone. |
I had considered that, but the number of available signals is fairly low, and node is already using sigusr1 so if I also caused node-chakracore to use sigusr2 as well then apps would have no signals left that they could override themselves. I discussed it with @digitalinfinity but I'm not sure we'd come to a solid conclusion either way. |
@yunong however we're still relatively new to the Linux world, so if you have thoughts on what the default behavior should be, we'd love to know! Right now, our thinking is that opt-in is the way to go, and maybe we can make it opt-in at runtime (perhaps with some form of signal-chaining?), but if you have some insight on how we should make it on by default without inconveniencing embedders, we're all ears! |
@digitalinfinity What about providing a runtime argument to Chakra that can opt into this without having to recompile? Let me also chat with some folks at Netflix and get back to you with some possible other solutions. |
Is there support for profiling of JS stack frames in Chakra? With the V8 engine, you could profile the stack frames at runtime. This is critical as it allows us to objectively observe, compare, and profile the CPU usage of our process. This is possible in both Linux (http://yunong.io/2015/11/23/generating-node-js-flame-graphs/) and Illumos (https://nodejs.org/en/blog/uncategorized/profiling-node-js/)
The text was updated successfully, but these errors were encountered: