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

Use OS calls rather than exec() to get memory stats on Darwin #161

Merged
merged 5 commits into from
Feb 21, 2016

Conversation

walles
Copy link
Contributor

@walles walles commented Feb 19, 2016

Before this change we used to exec() various binaries to find out memory
information.

While this worked, it was awfully slow.

And if somebody would want to compute how many percent of available memory all
PIDs on the system uses, that would take almost ten seconds on my laptop with
the previous implementation.

This implementation fares a lot better, and is smaller.

Before this change we used to exec() various binaries to find out memory
information.

While this worked, it was awfully slow.

And if somebody would want to compute how many percent of available memory all
PIDs on the system uses, that would take almost ten seconds on my laptop with
the previous implementation.

This implementation fares a lot better, and is smaller.
@shirou
Copy link
Owner

shirou commented Feb 19, 2016

At first, I wanted about avoiding cgo, so current implementation uses exec. But from #66, cgo is introduced to cpu, so we cross the Rubicon.

I can merge your series of excellent PRs, but could you move (not delete) current implementation to no_cgo file like cpu/cpu_darwin_nocgo.go, with !cgo build option? It can give options about use cgo or not to users.

@walles
Copy link
Contributor Author

walles commented Feb 20, 2016

CGO / non-CGO split done.

@shirou
Copy link
Owner

shirou commented Feb 21, 2016

Thanks a lot! CI also passed.

shirou added a commit that referenced this pull request Feb 21, 2016
Use OS calls rather than exec() to get memory stats on Darwin
@shirou shirou merged commit e04a02d into shirou:master Feb 21, 2016
@walles walles deleted the walles/darwin-vmperf branch February 21, 2016 17:34
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.

2 participants