Hi all,
I'm currently writing a new addon via C++, which targets to find out
busy loops in Node.js.
Sometimes we may write a busy loop in javascript, such as:
while (a > 1) {
// do something
}
a +1; // oops, never get here
Most of the time, easy to find. But there're some situation it is too
tricky to find these points.
And since we're in the busy loop, any of the other javascript code can't
happen.
To find these busy loops, my basic idea is to use profile. V8 provides a
way to start a profile, and if we have a chance to start it, profile
result will show where the busy loop is. But like I said, have no way to
trigger anything inside javascript land when loop.
I had a little scratch here <https://github.com/liuyanghejerry/whatsnow>
to show my mind. The basic idea is to catch a signal, like SIGINT, to
fire an alarm and begin a profile. When the alarm is alert, stop that
profile. Hotest code should be the code where busy loop is.
I'm not familiar with Linux programing neither with Node's kernel. So
I'm wondering is it a good idea to use alert in C++ addon to have a profile?
--
Best Regards,
liuyanghejerry
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/536E4D94.6040502%40gmail.com.
For more options, visit https://groups.google.com/d/optout.