Select Git revision
procinfo_mac.cpp
-
David Anderson authored
svn path=/trunk/boinc/; revision=20581
David Anderson authoredsvn path=/trunk/boinc/; revision=20581
procinfo_mac.cpp 5.71 KiB
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#define SHOW_TIMING 0
#include "config.h"
#include <cstdio>
#include <ctype.h>
#include <sys/types.h>
#include <dirent.h>
#if SHOW_TIMING
#include <Carbon/Carbon.h>
#endif
#include "procinfo.h"
#include "client_msgs.h"
#include "client_state.h"
using std::vector;
// build table of all processes in system
//
int procinfo_setup(vector<PROCINFO>& pi) {
int pid = getpid();
FILE* fd;
PROCINFO p;
int c, real_mem, virtual_mem, hours;
char* lf;
#if SHOW_TIMING
UnsignedWide start, end, elapsed;
start = UpTime();
#endif
// Some values of possible interest available from 'ps' command:
// %cpu percentage cpu usage (alias pcpu)
// %mem percentage memory usage (alias pmem)
// command command (executable name)
// majflt total page faults
// minflt total page reclaims
// nswap total swaps in/out
// pagein pageins (same as majflt)
// pid process ID
// ppid parent process ID
// poip pageouts in progress
// rss resident set size in Kbytes
// time accumulated cpu time, user + system
// vsz virtual size in Kbytes
//
// Unfortunately, the selectors majflt, minflt, pagein do not work on OS X,
// and ps does not return kernel time separately from user time.
//