Skip to content

Commit

Permalink
FreeBSD: fix total memory
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Dec 17, 2015
1 parent 24f7b2e commit bd9a58b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bug tracker at https://github.com/giampaolo/psutil/issues

3.3.1 - XXXX-XX-XX
3.4.0 - XXXX-XX-XX
==================

**Enhancements**
Expand All @@ -15,6 +15,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
- #714: [OpenBSD] virtual_memory().cached value was always set to 0.
- #715: don't crash at import time if cpu_times() fail for some reason.
- #717: [Linux] Process.open_files fails if deleted files still visible.
- #724: [FreeBSD] virtual_memory().total is slightly incorrect.


3.3.0 - 2015-11-25
Expand Down
2 changes: 1 addition & 1 deletion psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
]
__all__.extend(_psplatform.__extra__all__)
__author__ = "Giampaolo Rodola'"
__version__ = "3.3.1"
__version__ = "3.4.0"
version_info = tuple([int(num) for num in __version__.split('.')])
AF_LINK = _psplatform.AF_LINK
_TOTAL_PHYMEM = None
Expand Down
4 changes: 2 additions & 2 deletions psutil/arch/bsd/freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ psutil_virtual_mem(PyObject *self, PyObject *args) {
#endif
size_t buffers_size = sizeof(buffers);

if (sysctlbyname("vm.stats.vm.v_page_count", &total, &size, NULL, 0))
if (sysctlbyname("hw.physmem", &total, &size, NULL, 0))
goto error;
if (sysctlbyname("vm.stats.vm.v_active_count", &active, &size, NULL, 0))
goto error;
Expand All @@ -506,7 +506,7 @@ psutil_virtual_mem(PyObject *self, PyObject *args) {
goto error;

return Py_BuildValue("KKKKKKKK",
(unsigned long long) total * pagesize,
(unsigned long long) total,
(unsigned long long) free * pagesize,
(unsigned long long) active * pagesize,
(unsigned long long) inactive * pagesize,
Expand Down

0 comments on commit bd9a58b

Please sign in to comment.