mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=11174
This commit is contained in:
parent
1054e46f8e
commit
c56cb7e9bf
|
@ -10310,3 +10310,18 @@ Eric K 18 Sept 2006
|
|||
|
||||
client/
|
||||
client_types.C
|
||||
|
||||
Charlie 19 Sept 2006
|
||||
- Mac: Add process memory info for Mac, using a pipe to ps command.
|
||||
Does not set the page_fault_count, user_time or kernel_time fields
|
||||
in PROCINFO struct. See comments in procinfo_mac.C for other
|
||||
values of possible interest that are avaiable from ps command.
|
||||
- Fix compiler warning in http_curl.C.
|
||||
|
||||
client/
|
||||
http_curl.C
|
||||
lib/
|
||||
procinfo_mac.C (new)
|
||||
mac_build/
|
||||
boinc.xcodeproj/
|
||||
project.pbxproj
|
||||
|
|
|
@ -967,7 +967,7 @@ void HTTP_OP_SET::got_select(FDSET_GROUP&, double timeout) {
|
|||
if (hop->response >= 400) {
|
||||
strcpy(hop->error_msg, boincerror(hop->response));
|
||||
} else {
|
||||
sprintf(hop->error_msg, "HTTP error %d", hop->response);
|
||||
sprintf(hop->error_msg, "HTTP error %ld", hop->response);
|
||||
}
|
||||
switch (hop->response) {
|
||||
case HTTP_STATUS_NOT_FOUND:
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
// Berkeley Open Infrastructure for Network Computing
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2006 University of California
|
||||
//
|
||||
// This 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 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This software 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.
|
||||
//
|
||||
// To view the GNU Lesser General Public License visit
|
||||
// http://www.gnu.org/copyleft/lesser.html
|
||||
// or write to the Free Software Foundation, Inc.,
|
||||
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "procinfo.h"
|
||||
#include "client_msgs.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
|
||||
// build table of all processes in system
|
||||
//
|
||||
int procinfo_setup(vector<PROCINFO>& pi) {
|
||||
|
||||
FILE* fd;
|
||||
PROCINFO p;
|
||||
int c, real_mem, virtual_mem;
|
||||
|
||||
// Some values of possible interest available from 'ps' command:
|
||||
// %cpu percentage cpu usage (alias pcpu)
|
||||
// %mem percentage memory usage (alias pmem)
|
||||
// majflt total page faults
|
||||
// minflt total page reclaims
|
||||
// nswap total swaps in/out
|
||||
// pid process ID
|
||||
// ppid parent process ID
|
||||
// poip pageouts in progress
|
||||
// rss resident set size in Kbytes
|
||||
// rsz resident set size + (text size / text use count)
|
||||
// time accumulated cpu time, user + system
|
||||
// vsz virtual size in Kbytes
|
||||
|
||||
memset(&p, 0, sizeof(p));
|
||||
|
||||
fd = popen("ps -axopid,ppid,rss,vsz", "r");
|
||||
if (!fd) return 0;
|
||||
|
||||
// Skip over the header line
|
||||
do {
|
||||
c = fgetc(fd);
|
||||
if (c == EOF) {
|
||||
pclose(fd);
|
||||
return 0;
|
||||
}
|
||||
} while (c != '\n');
|
||||
|
||||
while (1) {
|
||||
c = fscanf(fd, "%5d%6d%6d%9d\n", &p.id, &p.parentid, &real_mem, &virtual_mem);
|
||||
if (c < 4) break;
|
||||
p.working_set_size = (double)real_mem * 1024.;
|
||||
p.swap_size = (double)virtual_mem * 1024.;
|
||||
p.is_boinc_app = false;
|
||||
pi.push_back(p);
|
||||
|
||||
}
|
||||
|
||||
pclose(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Scan the process table adding in CPU time and mem usage. Loop
|
||||
// thru entire table as the entries aren't in order. Recurse at
|
||||
// most 4 times to get additional child processes
|
||||
//
|
||||
void add_child_totals(PROCINFO& pi, vector<PROCINFO>& piv, int pid, int rlvl) {
|
||||
unsigned int i;
|
||||
|
||||
if (rlvl > 3) {
|
||||
return;
|
||||
}
|
||||
for (i=0; i<piv.size(); i++) {
|
||||
PROCINFO& p = piv[i];
|
||||
if (p.parentid == pid) {
|
||||
// pi.kernel_time += p.kernel_time;
|
||||
// pi.user_time += p.user_time;
|
||||
pi.swap_size += p.swap_size;
|
||||
pi.working_set_size += p.working_set_size;
|
||||
p.is_boinc_app = true;
|
||||
// look for child process of this one
|
||||
add_child_totals(pi, piv, p.id, rlvl+1); // recursion - woo hoo!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fill in the given PROCINFO (which initially is zero except for id)
|
||||
// with totals from that process and all its descendants
|
||||
//
|
||||
void procinfo_app(PROCINFO& pi, vector<PROCINFO>& piv) {
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<piv.size(); i++) {
|
||||
PROCINFO& p = piv[i];
|
||||
if (p.id == pi.id) {
|
||||
// pi.kernel_time += p.kernel_time;
|
||||
// pi.user_time += p.user_time;
|
||||
pi.swap_size += p.swap_size;
|
||||
pi.working_set_size += p.working_set_size;
|
||||
p.is_boinc_app = true;
|
||||
// look for child processes
|
||||
add_child_totals(pi, piv, pi.id, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void procinfo_other(PROCINFO& pi, vector<PROCINFO>& piv) {
|
||||
unsigned int i;
|
||||
|
||||
memset(&pi, 0, sizeof(pi));
|
||||
for (i=0; i<piv.size(); i++) {
|
||||
PROCINFO& p = piv[i];
|
||||
if (!p.is_boinc_app) {
|
||||
// pi.kernel_time += p.kernel_time;
|
||||
// pi.user_time += p.user_time;
|
||||
pi.swap_size += p.swap_size;
|
||||
pi.working_set_size += p.working_set_size;
|
||||
p.is_boinc_app = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -275,6 +275,7 @@
|
|||
DDAEC9FF07FA5A5C00A7BC36 /* SetVersion.C in Sources */ = {isa = PBXBuildFile; fileRef = DDAEC9E707FA58A000A7BC36 /* SetVersion.C */; };
|
||||
DDB5060E0958247800181B75 /* libwx_mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDB5060D0958247800181B75 /* libwx_mac.a */; };
|
||||
DDB506FA0958446900181B75 /* ProxyInfoPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDB506F80958446900181B75 /* ProxyInfoPage.cpp */; };
|
||||
DDB693500ABFE9C600689FD8 /* procinfo_mac.C in Sources */ = {isa = PBXBuildFile; fileRef = DDB6934F0ABFE9C600689FD8 /* procinfo_mac.C */; };
|
||||
DDBDF4AD0987093100464F83 /* ValidateEmailAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDBDF4A90987091800464F83 /* ValidateEmailAddress.cpp */; };
|
||||
DDC63EF10985B89600383FD2 /* DlgGenericMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDC63EEF0985B89600383FD2 /* DlgGenericMessage.cpp */; };
|
||||
DDCE78390A70BDC6008218B6 /* app_ipc.C in Sources */ = {isa = PBXBuildFile; fileRef = AA8B6B1B046C364400A80164 /* app_ipc.C */; };
|
||||
|
@ -963,7 +964,6 @@
|
|||
DD344BEF07C5B1770043025C /* proxy_info.C */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = proxy_info.C; path = ../lib/proxy_info.C; sourceTree = SOURCE_ROOT; };
|
||||
DD35353107E1E05C00C4718D /* libboinc_api.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libboinc_api.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DD3E15420A774397007E0084 /* sgBOINCManager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = sgBOINCManager.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DD3E15440A774397007E0084 /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info copy.plist"; sourceTree = "<group>"; };
|
||||
DD407A4A07D2FB1200163EF5 /* libboinc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libboinc.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DD407AB707D2FC7D00163EF5 /* mem_usage.C */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = mem_usage.C; path = ../lib/mem_usage.C; sourceTree = SOURCE_ROOT; };
|
||||
DD407AB807D2FC7D00163EF5 /* mem_usage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mem_usage.h; path = ../lib/mem_usage.h; sourceTree = SOURCE_ROOT; };
|
||||
|
@ -1119,6 +1119,7 @@
|
|||
DDB5060D0958247800181B75 /* libwx_mac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwx_mac.a; path = "../../wxMac-2.6.3/src/build/Deployment/libwx_mac.a"; sourceTree = SOURCE_ROOT; };
|
||||
DDB506F80958446900181B75 /* ProxyInfoPage.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ProxyInfoPage.cpp; path = ../clientgui/ProxyInfoPage.cpp; sourceTree = SOURCE_ROOT; };
|
||||
DDB506F90958446900181B75 /* ProxyInfoPage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ProxyInfoPage.h; path = ../clientgui/ProxyInfoPage.h; sourceTree = SOURCE_ROOT; };
|
||||
DDB6934F0ABFE9C600689FD8 /* procinfo_mac.C */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = procinfo_mac.C; path = ../lib/procinfo_mac.C; sourceTree = SOURCE_ROOT; };
|
||||
DDB8D5A5081FC8C700A5A1E8 /* postinstall */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.csh; name = postinstall; path = ../mac_installer/postinstall; sourceTree = SOURCE_ROOT; };
|
||||
DDBDF4A90987091800464F83 /* ValidateEmailAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ValidateEmailAddress.cpp; path = ../clientgui/ValidateEmailAddress.cpp; sourceTree = SOURCE_ROOT; };
|
||||
DDBDF4AA0987091800464F83 /* ValidateEmailAddress.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ValidateEmailAddress.h; path = ../clientgui/ValidateEmailAddress.h; sourceTree = SOURCE_ROOT; };
|
||||
|
@ -1390,7 +1391,6 @@
|
|||
DDF1F4A409822F8A00482C89 /* GR-Branding */,
|
||||
DD64E7D507D89DB800B176C8 /* Info.plist */,
|
||||
F51BDF4903086C46012012A7 /* InfoPlist.strings */,
|
||||
DD3E15440A774397007E0084 /* Info copy.plist */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
|
@ -1623,6 +1623,7 @@
|
|||
F54B901502AC0A2201FB7237 /* parse.h */,
|
||||
DD344BE407C5B1670043025C /* prefs.C */,
|
||||
DD344BE507C5B1670043025C /* prefs.h */,
|
||||
DDB6934F0ABFE9C600689FD8 /* procinfo_mac.C */,
|
||||
DD344BEF07C5B1770043025C /* proxy_info.C */,
|
||||
DD344BEE07C5B1770043025C /* proxy_info.h */,
|
||||
AAA31C97042157A800A80164 /* shmem.C */,
|
||||
|
@ -2813,6 +2814,7 @@
|
|||
DDD74DD407CF493E0065AC9D /* util.C in Sources */,
|
||||
DD6617880A3FFD8C00FFEBEB /* check_security.C in Sources */,
|
||||
DD431F240A415EE70060585A /* SetupSecurity.cpp in Sources */,
|
||||
DDB693500ABFE9C600689FD8 /* procinfo_mac.C in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue