2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2006-09-08 19:27:42 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2006-09-08 19:27:42 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// 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.
|
2006-09-08 19:27:42 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2006-09-08 19:27:42 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-09-08 19:27:42 +00:00
|
|
|
|
|
|
|
#ifndef _PROCINFO_
|
|
|
|
#define _PROCINFO_
|
|
|
|
|
2006-08-25 21:31:04 +00:00
|
|
|
#include <vector>
|
2011-09-02 17:45:29 +00:00
|
|
|
#include <map>
|
2006-08-25 21:31:04 +00:00
|
|
|
|
|
|
|
struct PROCINFO {
|
2013-04-03 00:23:37 +00:00
|
|
|
int id;
|
|
|
|
int parentid;
|
2006-08-28 18:22:07 +00:00
|
|
|
double swap_size;
|
2006-08-25 21:31:04 +00:00
|
|
|
double working_set_size;
|
2013-04-03 00:23:37 +00:00
|
|
|
double working_set_size_smoothed;
|
|
|
|
unsigned long page_fault_count;
|
2006-08-25 21:31:04 +00:00
|
|
|
double user_time;
|
|
|
|
double kernel_time;
|
2013-04-03 00:23:37 +00:00
|
|
|
bool is_boinc_app;
|
2010-09-29 16:45:47 +00:00
|
|
|
bool is_low_priority;
|
|
|
|
// running at or below priority of BOINC apps
|
2008-09-29 01:55:58 +00:00
|
|
|
char command[256];
|
2011-09-16 22:22:45 +00:00
|
|
|
bool scanned;
|
2006-09-08 19:27:42 +00:00
|
|
|
|
2013-04-03 00:23:37 +00:00
|
|
|
double page_fault_rate; // derived by higher-level code
|
2011-09-02 17:45:29 +00:00
|
|
|
std::vector<int> children;
|
2011-09-02 20:47:05 +00:00
|
|
|
|
|
|
|
PROCINFO(){}
|
|
|
|
void clear() {
|
|
|
|
id = 0;
|
|
|
|
parentid = 0;
|
|
|
|
swap_size = 0;
|
|
|
|
working_set_size = 0;
|
2011-10-26 23:23:01 +00:00
|
|
|
//working_set_size_smoothed = 0;
|
|
|
|
// *Don't* clear this
|
2011-09-02 20:47:05 +00:00
|
|
|
page_fault_count = 0;
|
|
|
|
user_time = 0;
|
|
|
|
kernel_time = 0;
|
|
|
|
is_boinc_app = false;
|
|
|
|
is_low_priority = false;
|
|
|
|
command[0] = 0;
|
2011-09-16 22:22:45 +00:00
|
|
|
scanned = false;
|
2011-09-02 20:47:05 +00:00
|
|
|
page_fault_rate = 0;
|
|
|
|
children.clear();
|
|
|
|
}
|
2006-08-25 21:31:04 +00:00
|
|
|
};
|
|
|
|
|
2011-09-02 17:45:29 +00:00
|
|
|
typedef std::map<int, PROCINFO> PROC_MAP;
|
|
|
|
|
|
|
|
extern void find_children(PROC_MAP&);
|
|
|
|
// fill in the children fields
|
|
|
|
|
|
|
|
extern int procinfo_setup(PROC_MAP&);
|
2013-04-03 00:23:37 +00:00
|
|
|
// call this first to get data structure
|
2011-09-02 20:47:05 +00:00
|
|
|
|
|
|
|
extern void procinfo_app(
|
|
|
|
PROCINFO&, std::vector<int>* other_pids, PROC_MAP&, char* graphics_exec_file
|
|
|
|
);
|
2013-04-03 00:23:37 +00:00
|
|
|
// get info for a given app, and mark processes as BOINC
|
2011-09-02 20:47:05 +00:00
|
|
|
|
2011-09-02 17:45:29 +00:00
|
|
|
extern void procinfo_non_boinc(PROCINFO&, PROC_MAP&);
|
2013-04-03 00:23:37 +00:00
|
|
|
// After getting info for all BOINC apps,
|
|
|
|
// call this to get info for everything else
|
2011-11-29 15:06:08 +00:00
|
|
|
|
|
|
|
extern double process_tree_cpu_time(int pid);
|
|
|
|
// get the CPU time of the given process and its descendants
|
|
|
|
|
2006-09-08 22:35:19 +00:00
|
|
|
#endif
|