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

Include inactive memory in mac/linux available. #25

Merged
merged 1 commit into from
May 19, 2015
Merged

Include inactive memory in mac/linux available. #25

merged 1 commit into from
May 19, 2015

Conversation

dbwiddis
Copy link
Member

Closes #23.

@@ -8,6 +8,7 @@ Next
* Added Travis-CI - [@dblock](https://github.com/dblock).
* Added TODO list and enhanced README documentation - [@ptitvert](https://github.com/ptitvert)
* [#15](https://github.com/dblock/oshi/pull/15), [#18](https://github.com/dblock/oshi/pull/18): Added support for CPU load - [@kamenitxan](https://github.com/kamenitxan), [@Sorceror](https://github.com/Sorceror).
* Include inactive memory in mac/linux available - [@dbwiddis](https://github.com/dbwiddis).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this something that looks like the line above:

[#25](https://github.com/dblock/oshi/pull/25): Include inactive memory amount in GlobalMemory#getAvailable on Mac/LLinux - [ ... ]

You can commit with --amend and force push up to avoid having to re-squash things.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I didn't have the pull request # until I committed (I suppose I could have guessed). And since I've been committing via svn, I am really unfamiliar with the git command lines to do this. Argh. I'll do my best, I guess... you're really making me have to learn new tools!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an opportunity!

We force this strange construction where you commit, then push, then make a pull request, then amend. It's weird, but it's the best we have for changelog entries that seems to make the customer (the developer reading the changelog) happy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that was painful, until I figured out to use the -f switch on my push... I think this is finally all set.

@dblock
Copy link
Collaborator

dblock commented May 18, 2015

It may be hard, but is there a way to write a test here that would have failed without the code change? Try something?

@dbwiddis
Copy link
Member Author

For testing, we can try to parse other memory commands.

  • on Linux the code draws from /proc/meminfo. We could parse the output from "free -m" instead and look at the "free" column. The old version matches the first "Mem:" line, the fixed version would match the second "-/+ buffers/cache"" line. (We could also pull info from vmstat or top.)
  • on Mac the code draws from vm_stat. We can pull from top (top -l 1 | grep PhysMem) to find the old, incorrect value. I don't know if there's any other command line version to get the new version, but it's available on system information display.
    Unforunately, for both tests, there's no way to guarantee that a system will have nomzero inactive memory. Right after reboot, the numbers may be similar/equal.

dblock added a commit that referenced this pull request May 19, 2015
Include inactive memory in mac/linux available.
@dblock dblock merged commit 1cba58e into oshi:master May 19, 2015
@dblock
Copy link
Collaborator

dblock commented May 19, 2015

Merged, looking forward to more!

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.

Free memory vs. Available memory
2 participants