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 {
|
2010-11-23 19:39:47 +00:00
|
|
|
double flops_used; // based on peak flops
|
|
|
|
double flops_wasted;
|
2007-04-10 20:13:15 +00:00
|
|
|
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;
|
2010-11-23 19:39:47 +00:00
|
|
|
double wasted_frac;
|
|
|
|
double idle_frac;
|
2010-12-22 18:59:07 +00:00
|
|
|
int nrpcs;
|
2007-04-10 20:13:15 +00:00
|
|
|
|
2007-04-10 21:56:11 +00:00
|
|
|
void compute();
|
2011-03-15 19:16:13 +00:00
|
|
|
void print(FILE* f, bool human_readable=false);
|
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 {
|
2010-11-23 19:39:47 +00:00
|
|
|
double flops_used; // based on peak flops
|
|
|
|
double flops_wasted;
|
2007-04-10 20:13:15 +00:00
|
|
|
int nresults_met_deadline;
|
|
|
|
int nresults_missed_deadline;
|
2010-09-28 20:17:09 +00:00
|
|
|
|
|
|
|
PROJECT_RESULTS() {
|
2010-11-23 19:39:47 +00:00
|
|
|
flops_used = 0;
|
|
|
|
flops_wasted = 0;
|
2010-09-28 20:17:09 +00:00
|
|
|
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;
|
2010-10-19 15:48:33 +00:00
|
|
|
double std_dev;
|
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-12-18 17:09:57 +00:00
|
|
|
bool sample(double dt);
|
|
|
|
void init(double f, double l);
|
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-12-22 18:59:07 +00:00
|
|
|
extern RANDOM_PROCESS on_proc;
|
|
|
|
extern RANDOM_PROCESS connected_proc;
|
|
|
|
extern RANDOM_PROCESS active_proc;
|
|
|
|
extern RANDOM_PROCESS gpu_active_proc;
|
|
|
|
|
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-15 20:16:00 +00:00
|
|
|
#define START_TIME 3600
|
|
|
|
// should be at least an hour or so
|
2010-07-20 04:19:22 +00:00
|
|
|
|
2010-09-24 20:02:42 +00:00
|
|
|
#endif
|