-
Notifications
You must be signed in to change notification settings - Fork 39
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
Added heap used and total heap statistics. #35
base: master
Are you sure you want to change the base?
Conversation
Thank you for submitting this pull request, however I do not see a valid CLA on file for you. Before we can merge this request please visit https://yahoocla.herokuapp.com/ and agree to the terms. Thanks! 😄 |
H, I have completed the CLA. I'm not sure if I need to resubmit this pull request or if it will automatically detect the signed CLA now. |
It should pick it up, no need to add another PR :) |
CLA is valid! |
@@ -404,6 +404,8 @@ void NodeMonitor::setStatistics() { | |||
Nan::GetHeapStatistics(&v8stats); | |||
|
|||
stats_.pmem_ = (v8stats.used_heap_size() / (double) v8stats.total_heap_size()); | |||
stats_.usedheap_ = v8stats.used_heap_size(); | |||
stats_.totalheap_ = v8stats.total_heap_size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How expensive are these calls? Should we try to make them only once each?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes. that's probably a much better idea. I've updated the code to not do the extra call.
Hi. I've added some extra methods to set a couple custom properties in the json as well as to configure the report interval at runtime. |
static bool _show_backtrace = false; //< default to false for performance | ||
|
||
// Normally reports will be sent every REPORT_INTERVAL_MS | ||
// However, if there is no receiver on the other end (i.e. sendmsg() | ||
// returns -1), then the reporting thread will wait MAX_INACTIVITY_RETRIES | ||
// before trying again. | ||
static const int REPORT_INTERVAL_MS = 1000; | ||
static int REPORT_INTERVAL_MS = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this static const int
?
It's been more than 2 years, will this ever be added? |
I also clarified the definition of the "mem" attribute to be the ratio of heap used to total heap.