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

Fixed statistics for FreeBSD #1125

Merged
merged 1 commit into from
Nov 26, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/Statistics/statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@

#include "Basics/locks.h"

#ifdef TRI_HAVE_MACOS_MEM_STATS
#ifndef BSD
#ifdef __FreeBSD__
#define BSD
#endif
#endif

#if (defined(BSD) || defined(TRI_HAVE_MACOS_MEM_STATS))
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
Expand Down Expand Up @@ -342,7 +348,7 @@ static void DestroyStatisticsList (TRI_statistics_list_t* list) {
/// @brief gets the physical memory
////////////////////////////////////////////////////////////////////////////////

#ifdef TRI_HAVE_MACOS_MEM_STATS
#if (defined(BSD) || defined(TRI_HAVE_MACOS_MEM_STATS))

static uint64_t GetPhysicalMemory () {
int mib[2];
Expand All @@ -351,7 +357,11 @@ static uint64_t GetPhysicalMemory () {

// Get the Physical memory size
mib[0] = CTL_HW;
#ifdef TRI_HAVE_MACOS_MEM_STATS
mib[1] = HW_MEMSIZE;
#else
mib[1] = HW_PHYSMEM; // The bytes of physical memory. (kenel + user space)
#endif
length = sizeof(int64_t);
sysctl(mib, 2, &physicalMemory, &length, nullptr, 0);

Expand Down