Skip to content
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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

amit777
Copy link

@amit777 amit777 commented Apr 28, 2016

I also clarified the definition of the "mem" attribute to be the ratio of heap used to total heap.

@yahoocla
Copy link

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! 😄

@amit777
Copy link
Author

amit777 commented Apr 28, 2016

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.

@davglass
Copy link

It should pick it up, no need to add another PR :)

@yahoocla
Copy link

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();
Copy link
Contributor

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?

Copy link
Author

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.

@amit777
Copy link
Author

amit777 commented Apr 29, 2016

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;
Copy link
Contributor

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?

@mrantivirus
Copy link

It's been more than 2 years, will this ever be added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants