~jhelioviewer-dev/esajpip/esa-jpip

« back to all changes in this revision

Viewing changes to src/app_info.cc

  • Committer: jp.garcia.ortiz at gmail
  • Date: 2012-02-25 16:55:29 UTC
  • Revision ID: jp.garcia.ortiz@gmail.com-20120225165529-19pzvt04u7bmiv95
Compilation on Mac OS X supported, using MacPorts. Not fully tested yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include <string>
11
11
#include <sstream>
12
12
#include <fstream>
 
13
 
 
14
#ifndef _SC_AVPHYS_PAGES
 
15
#include <sys/sysctl.h>
 
16
#endif
 
17
 
13
18
#include "app_info.h"
14
19
 
15
20
 
48
53
 
49
54
AppInfo& AppInfo::Update()
50
55
{
 
56
  #if defined(_SC_AVPHYS_PAGES)
51
57
  {
52
58
    long page_size = sysconf(_SC_PAGE_SIZE);
53
59
    long avpages = sysconf(_SC_AVPHYS_PAGES);
54
60
    available_memory_ = (avpages * page_size / (1024.0 * 1024.0));
55
61
  }
 
62
  #elif defined(HW_PHYSMEM)
 
63
  { 
 
64
    unsigned int physmem;
 
65
    size_t len = sizeof(physmem);
 
66
    static int mib[2] = { CTL_HW, HW_PHYSMEM };
 
67
 
 
68
    sysctl(mib, sizeof(mib) * sizeof(mib[0]), &physmem, &len, NULL, 0);
 
69
    available_memory_ = (double) physmem;
 
70
  }
 
71
  #endif
56
72
 
57
73
  {
58
74
    is_running_ = false;