2008-08-05 22:52:17 +00:00
|
|
|
// 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/>.
|
|
|
|
//
|
2007-02-15 21:11:05 +00:00
|
|
|
|
2010-09-24 20:02:42 +00:00
|
|
|
#ifndef _SIM_H_
|
|
|
|
#define _SIM_H_
|
2007-02-15 21:11:05 +00:00
|
|
|
|
2010-09-24 20:02:42 +00:00
|
|
|
#include <vector>
|
2007-02-15 21:11:05 +00:00
|
|
|
|
2010-09-24 20:02:42 +00:00
|
|
|
using std::vector;
|
2007-02-24 14:55:59 +00:00
|
|
|
|
2007-04-10 20:13:15 +00:00
|
|
|
struct SIM_RESULTS {
|
|
|
|
double cpu_used;
|
|
|
|
double cpu_wasted;
|
|
|
|
double cpu_idle;
|
|
|
|
int nresults_met_deadline;
|
|
|
|
int nresults_missed_deadline;
|
2007-04-10 21:56:11 +00:00
|
|
|
double share_violation;
|
2007-07-12 19:52:58 +00:00
|
|
|
double monotony;
|
2007-04-10 21:56:11 +00:00
|
|
|
double cpu_wasted_frac;
|
|
|
|
double cpu_idle_frac;
|
2007-04-10 20:13:15 +00:00
|
|
|
|
2007-04-10 21:56:11 +00:00
|
|
|
void compute();
|
|
|
|
void print(FILE* f, const char* title=0);
|
2007-04-10 20:13:15 +00:00
|
|
|
void parse(FILE* f);
|
|
|
|
void add(SIM_RESULTS& r);
|
2007-05-04 23:05:17 +00:00
|
|
|
void divide(int);
|
|
|
|
void clear();
|
2007-04-10 20:13:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PROJECT_RESULTS {
|
|
|
|
double cpu_used;
|
|
|
|
double cpu_wasted;
|
|
|
|
int nresults_met_deadline;
|
|
|
|
int nresults_missed_deadline;
|
2010-09-28 20:17:09 +00:00
|
|
|
|
|
|
|
PROJECT_RESULTS() {
|
|
|
|
cpu_used = 0;
|
|
|
|
cpu_wasted = 0;
|
|
|
|
nresults_met_deadline = 0;
|
|
|
|
nresults_missed_deadline = 0;
|
|
|
|
}
|
2007-04-10 20:13:15 +00:00
|
|
|
};
|
2007-02-24 20:10:06 +00:00
|
|
|
|
2010-04-28 16:22:06 +00:00
|
|
|
struct NORMAL_DIST {
|
2007-02-24 20:10:06 +00:00
|
|
|
double mean;
|
2007-04-04 19:34:01 +00:00
|
|
|
double stdev;
|
2010-09-24 20:02:42 +00:00
|
|
|
int parse(XML_PARSER&, const char* end_tag);
|
2007-02-24 20:10:06 +00:00
|
|
|
double sample();
|
|
|
|
};
|
|
|
|
|
2010-04-28 16:22:06 +00:00
|
|
|
struct UNIFORM_DIST {
|
2007-02-24 20:10:06 +00:00
|
|
|
double lo;
|
|
|
|
double hi;
|
2010-09-24 20:02:42 +00:00
|
|
|
int parse(XML_PARSER&, const char* end_tag);
|
2007-02-24 20:10:06 +00:00
|
|
|
double sample();
|
|
|
|
};
|
|
|
|
|
|
|
|
class RANDOM_PROCESS {
|
2007-04-09 02:17:26 +00:00
|
|
|
double last_time;
|
|
|
|
double time_left;
|
|
|
|
bool value;
|
|
|
|
double off_lambda;
|
2007-02-24 20:10:06 +00:00
|
|
|
public:
|
|
|
|
double frac;
|
|
|
|
double lambda;
|
2010-09-24 20:02:42 +00:00
|
|
|
int parse(XML_PARSER&, const char* end_tag);
|
2007-04-09 02:17:26 +00:00
|
|
|
bool sample(double);
|
2010-01-21 00:14:56 +00:00
|
|
|
void init(double);
|
2007-04-09 02:17:26 +00:00
|
|
|
RANDOM_PROCESS();
|
2007-02-24 20:10:06 +00:00
|
|
|
};
|
|
|
|
|
2007-05-08 01:55:28 +00:00
|
|
|
extern FILE* logfile;
|
|
|
|
extern bool user_active;
|
2010-10-08 23:18:12 +00:00
|
|
|
extern std::string html_msg;
|
2007-05-08 01:55:28 +00:00
|
|
|
extern SIM_RESULTS sim_results;
|
|
|
|
extern double calculate_exponential_backoff(
|
|
|
|
int n, double MIN, double MAX
|
|
|
|
);
|
|
|
|
|
2007-05-09 15:23:10 +00:00
|
|
|
extern bool dcf_dont_use;
|
|
|
|
extern bool dcf_stats;
|
2007-05-15 20:29:26 +00:00
|
|
|
extern bool cpu_sched_rr_only;
|
|
|
|
extern bool dual_dcf;
|
2007-07-11 20:13:53 +00:00
|
|
|
extern bool work_fetch_old;
|
2009-12-07 00:53:32 +00:00
|
|
|
extern bool gpus_usable;
|
2008-10-29 00:00:01 +00:00
|
|
|
|
2010-10-06 22:56:31 +00:00
|
|
|
//#define START_TIME 946684800
|
2010-01-21 00:14:56 +00:00
|
|
|
// Jan 1 2000
|
2010-10-06 22:56:31 +00:00
|
|
|
#define START_TIME 0
|
2010-07-20 04:19:22 +00:00
|
|
|
|
2010-09-24 20:02:42 +00:00
|
|
|
#endif
|