-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profile JS code #637
Comments
Hi @ram-vet, There is console.time() and console.timeEnd() pair for njs CLI. Otherwise there no profiling tools specific to njs. Please elaborate what you are trying to profile and what part of nginx/njs you are trying to measure. |
Hi @ram-vet https://gist.github.com/tippexs/59cc1a2d2e2b909947ba22a63608a90b It is not in an state where it would make sense to call it a tool but what you can basically do with it is measure execution times of NJS functions and write them to a file. $ ~> node index.js
event1: Min: 1, Middle 80.52228112910159, Max: 305, Std. Deviation: 44.29781599231003, Start: 167116922931, End: Start: 167116926031
event2 server 1: Min: 0, Middle 1.2707481005260082, Max: 101, Std. Deviation: 4.78749625209064, Start: 167116922872, End: Start: 167116926027
event3 server 2: Min: 1, Middle 78.99934512115259, Max: 294, Std. Deviation: 41.49847599276098, Start: 167116922931, End: Start: 167116926031
File successfully created!
File successfully created! It will generate a log file and a little NodeJs application can actually create diagrams like this one. All of this is very hacky :D and I feel very bad sharing the code as it will be (with a very high chance) the most ugliest piece of code you have ever seen in your live. Not kidding. But let me know if this sounds useful to you. Happy to upload the stuff to a github repository. |
Hi, is there a way to profile JS code in NJS ? Or any other possible integration for profiling just the JS part.
The text was updated successfully, but these errors were encountered: