mirror of https://github.com/BOINC/boinc.git
- client: tweak to ATI CPU recognition
from [P3D] Crashtest svn path=/trunk/boinc/; revision=22845
This commit is contained in:
parent
93902c1475
commit
3a9549979e
|
@ -8788,7 +8788,7 @@ David 17 Dec 2010
|
||||||
"Add" is confusing, because you can't add multiple account managers
|
"Add" is confusing, because you can't add multiple account managers
|
||||||
like you add projects.
|
like you add projects.
|
||||||
- client: recognize a few new ATI GPU models
|
- client: recognize a few new ATI GPU models
|
||||||
from Robert Kreß
|
from [P3D] Crashtest
|
||||||
|
|
||||||
client/
|
client/
|
||||||
client_msgs.cpp
|
client_msgs.cpp
|
||||||
|
@ -8804,3 +8804,9 @@ David 17 Dec 2010
|
||||||
|
|
||||||
api/
|
api/
|
||||||
boinc_api.cpp
|
boinc_api.cpp
|
||||||
|
|
||||||
|
David 17 Dec 2010
|
||||||
|
- client: tweak to ATI CPU recognition
|
||||||
|
from [P3D] Crashtest
|
||||||
|
client/
|
||||||
|
coproc_detect.cpp
|
||||||
|
|
|
@ -467,11 +467,6 @@ struct CLIENT_STATE {
|
||||||
void compute_nuploading_results();
|
void compute_nuploading_results();
|
||||||
|
|
||||||
#ifdef SIM
|
#ifdef SIM
|
||||||
RANDOM_PROCESS available;
|
|
||||||
RANDOM_PROCESS idle;
|
|
||||||
double connection_interval;
|
|
||||||
// don't connect more often than this
|
|
||||||
|
|
||||||
double share_violation();
|
double share_violation();
|
||||||
double monotony();
|
double monotony();
|
||||||
|
|
||||||
|
|
|
@ -826,16 +826,16 @@ void COPROC_ATI::get(
|
||||||
gpu_name="ATI Radeon HD 4700/4800 (RV740/RV770)";
|
gpu_name="ATI Radeon HD 4700/4800 (RV740/RV770)";
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
gpu_name="ATI Radeon HD 5800 series (Cypress)"; // fixed from "old" HD5800 to HD 5800 like the others up there
|
gpu_name="ATI Radeon HD 5800 series (Cypress)";
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
gpu_name="ATI Radeon HD 5700 series (Juniper)"; // fixed from HD5700 to HD 5700 ...
|
gpu_name="ATI Radeon HD 5700 series (Juniper)";
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
gpu_name="ATI Radeon HD 5x00 series (Redwood)"; // fixed from HD5x00 to HD 5x00 ....
|
gpu_name="ATI Radeon HD 5x00 series (Redwood)";
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
gpu_name="ATI Radeon HD 5x00 series (Cedar)"; // fixed from HD5x00 to HD 5x00 ....
|
gpu_name="ATI Radeon HD 5x00 series (Cedar)";
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// based on AMD's Stream SDK 2.3 shipped with AMD Catalyst 10.12 APP
|
// based on AMD's Stream SDK 2.3 shipped with AMD Catalyst 10.12 APP
|
||||||
|
@ -845,28 +845,28 @@ void COPROC_ATI::get(
|
||||||
//
|
//
|
||||||
// added new/current/coming AMD RADEON GPUs/IGPs/APUs
|
// added new/current/coming AMD RADEON GPUs/IGPs/APUs
|
||||||
case 12:
|
case 12:
|
||||||
gpu_name="AMD SUMO"; // not yet identifyed should be AMD SUMO - the Fusion APU inside "Llano"
|
gpu_name="AMD SUMO";
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
gpu_name="AMD SUPERSUMO"; // not yet identifyed should be AMD SuperSUMO - an other Fusion APU
|
gpu_name="AMD SUPERSUMO";
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
gpu_name="AMD Radeon HD 6310 (Wrestler)"; // Fusion APU inside AMDs Brazos Plattform
|
gpu_name="AMD Radeon HD 6250/6310 (Wrestler)";
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
gpu_name="AMD Radeon HD 6900 series (Cayman)"; // new AMD Radeon HD 6950 & 6970 ;;;; Double Precision YES
|
gpu_name="AMD Radeon HD 6900 series (Cayman)";
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
gpu_name="AMD RESERVED2"; // not yet identifyed should be AMD Antilles because it's VLIW4-Architecture ;;;; Double Precision YES
|
gpu_name="AMD RESERVED2";
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
gpu_name="AMD Radeon HD 6800 series (Barts)"; // ;;;;; Double Precision NO
|
gpu_name="AMD Radeon HD 6800 series (Barts)";
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
gpu_name="AMD Radeon HD 6x00 series (Turks)"; // ;;;;; Double Precision NO;
|
gpu_name="AMD Radeon HD 6x00 series (Turks)";
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
gpu_name="AMD Radeon HD 6300 series (Caicos)"; // ;;;;; Double Precision NO
|
gpu_name="AMD Radeon HD 6300 series (Caicos)";
|
||||||
break;
|
break;
|
||||||
// there arent any other target ids inside the Shadercompiler (YET !!! )
|
// there arent any other target ids inside the Shadercompiler (YET !!! )
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -499,23 +499,6 @@ int CLIENT_STATE::parse_state_file_aux(const char* fname) {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef SIM
|
|
||||||
if (parse_double(buf, "<connection_interval>", connection_interval)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (match_tag(buf, "<available>")) {
|
|
||||||
XML_PARSER xp(&mf);
|
|
||||||
available.parse(xp, "/available");
|
|
||||||
available.init(START_TIME);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (match_tag(buf, "<idle>")) {
|
|
||||||
XML_PARSER xp(&mf);
|
|
||||||
idle.parse(xp, "/idle");
|
|
||||||
idle.init(START_TIME);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (log_flags.unparsed_xml) {
|
if (log_flags.unparsed_xml) {
|
||||||
msg_printf(0, MSG_INFO,
|
msg_printf(0, MSG_INFO,
|
||||||
|
|
|
@ -494,9 +494,11 @@ int read_config_file(bool init, const char* fname) {
|
||||||
int retval = config.parse(f);
|
int retval = config.parse(f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (retval) return retval;
|
if (retval) return retval;
|
||||||
|
#ifndef SIM
|
||||||
diagnostics_set_max_file_sizes(
|
diagnostics_set_max_file_sizes(
|
||||||
config.max_stdout_file_size, config.max_stderr_file_size
|
config.max_stdout_file_size, config.max_stderr_file_size
|
||||||
);
|
);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
166
client/sim.cpp
166
client/sim.cpp
|
@ -30,13 +30,16 @@
|
||||||
// timeline.html
|
// timeline.html
|
||||||
// log.txt
|
// log.txt
|
||||||
// summary.xml
|
// summary.xml
|
||||||
// debt.dat
|
// if using REC:
|
||||||
// debt_overall.png
|
// rec.png
|
||||||
// debt_cpu_std.png
|
// if not using REC:
|
||||||
// debt_cpu_ltd.png
|
// debt.dat
|
||||||
// debt_nvidia_std.png
|
// debt_overall.png
|
||||||
// debt_nvidia_ltd.png
|
// debt_cpu_std.png
|
||||||
// ...
|
// debt_cpu_ltd.png
|
||||||
|
// debt_nvidia_std.png
|
||||||
|
// debt_nvidia_ltd.png
|
||||||
|
// ...
|
||||||
//
|
//
|
||||||
// Simulation params:
|
// Simulation params:
|
||||||
// [--duration x]
|
// [--duration x]
|
||||||
|
@ -79,11 +82,19 @@ FILE* index_file;
|
||||||
char log_filename[256];
|
char log_filename[256];
|
||||||
|
|
||||||
string html_msg;
|
string html_msg;
|
||||||
bool running;
|
|
||||||
double running_time = 0;
|
double running_time = 0;
|
||||||
bool server_uses_workload = false;
|
bool server_uses_workload = false;
|
||||||
bool cpu_sched_rr_only;
|
bool cpu_sched_rr_only;
|
||||||
|
|
||||||
|
RANDOM_PROCESS on_proc;
|
||||||
|
RANDOM_PROCESS active_proc;
|
||||||
|
RANDOM_PROCESS gpu_active_proc;
|
||||||
|
RANDOM_PROCESS connected_proc;
|
||||||
|
bool on;
|
||||||
|
bool active;
|
||||||
|
bool gpu_active;
|
||||||
|
bool connected;
|
||||||
|
|
||||||
SIM_RESULTS sim_results;
|
SIM_RESULTS sim_results;
|
||||||
|
|
||||||
void usage(char* prog) {
|
void usage(char* prog) {
|
||||||
|
@ -308,21 +319,10 @@ double get_estimated_delay(RESULT* rp) {
|
||||||
//
|
//
|
||||||
bool CLIENT_STATE::simulate_rpc(PROJECT* p) {
|
bool CLIENT_STATE::simulate_rpc(PROJECT* p) {
|
||||||
char buf[256], buf2[256];
|
char buf[256], buf2[256];
|
||||||
static double last_time=0;
|
|
||||||
vector<IP_RESULT> ip_results;
|
vector<IP_RESULT> ip_results;
|
||||||
int infeasible_count = 0;
|
int infeasible_count = 0;
|
||||||
vector<RESULT*> new_results;
|
vector<RESULT*> new_results;
|
||||||
|
|
||||||
double diff = now - last_time;
|
|
||||||
if (diff && diff < connection_interval) {
|
|
||||||
msg_printf(NULL, MSG_INFO,
|
|
||||||
"simulate_rpc: too soon %f < %f",
|
|
||||||
diff, connection_interval
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
last_time = now;
|
|
||||||
|
|
||||||
// save request params for WORK_FETCH::handle_reply
|
// save request params for WORK_FETCH::handle_reply
|
||||||
//
|
//
|
||||||
double save_cpu_req_secs = cpu_work_fetch.req_secs;
|
double save_cpu_req_secs = cpu_work_fetch.req_secs;
|
||||||
|
@ -482,6 +482,8 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACTIVE_TASK_SET::poll() {
|
bool ACTIVE_TASK_SET::poll() {
|
||||||
|
if (!active) return false;
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
bool action = false;
|
bool action = false;
|
||||||
|
@ -491,8 +493,6 @@ bool ACTIVE_TASK_SET::poll() {
|
||||||
last_time = gstate.now;
|
last_time = gstate.now;
|
||||||
PROJECT* p;
|
PROJECT* p;
|
||||||
|
|
||||||
if (!running) return false;
|
|
||||||
|
|
||||||
for (i=0; i<gstate.projects.size(); i++) {
|
for (i=0; i<gstate.projects.size(); i++) {
|
||||||
p = gstate.projects[i];
|
p = gstate.projects[i];
|
||||||
p->idle = true;
|
p->idle = true;
|
||||||
|
@ -519,7 +519,9 @@ bool ACTIVE_TASK_SET::poll() {
|
||||||
if (atp->task_state() != PROCESS_EXECUTING) continue;
|
if (atp->task_state() != PROCESS_EXECUTING) continue;
|
||||||
RESULT* rp = atp->result;
|
RESULT* rp = atp->result;
|
||||||
if (rp->uses_coprocs()) {
|
if (rp->uses_coprocs()) {
|
||||||
cpu_usage_gpu += rp->avp->avg_ncpus;
|
if (gpu_active) {
|
||||||
|
cpu_usage_gpu += rp->avp->avg_ncpus;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cpu_usage_cpu += rp->avp->avg_ncpus;
|
cpu_usage_cpu += rp->avp->avg_ncpus;
|
||||||
}
|
}
|
||||||
|
@ -535,36 +537,37 @@ bool ACTIVE_TASK_SET::poll() {
|
||||||
|
|
||||||
for (i=0; i<active_tasks.size(); i++) {
|
for (i=0; i<active_tasks.size(); i++) {
|
||||||
ACTIVE_TASK* atp = active_tasks[i];
|
ACTIVE_TASK* atp = active_tasks[i];
|
||||||
switch (atp->task_state()) {
|
if (atp->task_state() != PROCESS_EXECUTING) continue;
|
||||||
case PROCESS_EXECUTING:
|
RESULT* rp = atp->result;
|
||||||
atp->elapsed_time += diff;
|
if (!gpu_active && rp->uses_coprocs()) {
|
||||||
RESULT* rp = atp->result;
|
continue;
|
||||||
double flops = rp->avp->flops;
|
|
||||||
if (!rp->uses_coprocs()) {
|
|
||||||
flops *= cpu_scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
atp->flops_left -= diff*flops;
|
|
||||||
|
|
||||||
atp->fraction_done = 1 - (atp->flops_left / rp->wup->rsc_fpops_est);
|
|
||||||
atp->checkpoint_wall_time = gstate.now;
|
|
||||||
|
|
||||||
if (atp->flops_left <= 0) {
|
|
||||||
atp->set_task_state(PROCESS_EXITED, "poll");
|
|
||||||
rp->exit_status = 0;
|
|
||||||
rp->ready_to_report = true;
|
|
||||||
gstate.request_schedule_cpus("ATP poll");
|
|
||||||
gstate.request_work_fetch("ATP poll");
|
|
||||||
sprintf(buf, "result %s finished<br>", rp->name);
|
|
||||||
html_msg += buf;
|
|
||||||
action = true;
|
|
||||||
}
|
|
||||||
double pf = app_peak_flops(rp->avp, diff, cpu_scale);
|
|
||||||
rp->project->project_results.flops_used += pf;
|
|
||||||
rp->peak_flop_count += pf;
|
|
||||||
sim_results.flops_used += pf;
|
|
||||||
rp->project->idle = false;
|
|
||||||
}
|
}
|
||||||
|
atp->elapsed_time += diff;
|
||||||
|
double flops = rp->avp->flops;
|
||||||
|
if (!rp->uses_coprocs()) {
|
||||||
|
flops *= cpu_scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
atp->flops_left -= diff*flops;
|
||||||
|
|
||||||
|
atp->fraction_done = 1 - (atp->flops_left / rp->wup->rsc_fpops_est);
|
||||||
|
atp->checkpoint_wall_time = gstate.now;
|
||||||
|
|
||||||
|
if (atp->flops_left <= 0) {
|
||||||
|
atp->set_task_state(PROCESS_EXITED, "poll");
|
||||||
|
rp->exit_status = 0;
|
||||||
|
rp->ready_to_report = true;
|
||||||
|
gstate.request_schedule_cpus("ATP poll");
|
||||||
|
gstate.request_work_fetch("ATP poll");
|
||||||
|
sprintf(buf, "result %s finished<br>", rp->name);
|
||||||
|
html_msg += buf;
|
||||||
|
action = true;
|
||||||
|
}
|
||||||
|
double pf = app_peak_flops(rp->avp, diff, cpu_scale);
|
||||||
|
rp->project->project_results.flops_used += pf;
|
||||||
|
rp->peak_flop_count += pf;
|
||||||
|
sim_results.flops_used += pf;
|
||||||
|
rp->project->idle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<gstate.projects.size(); i++) {
|
for (i=0; i<gstate.projects.size(); i++) {
|
||||||
|
@ -824,7 +827,24 @@ void html_rec() {
|
||||||
}
|
}
|
||||||
fprintf(html_out, "<table border=1><tr><td width=%d valign=top>%.0f</td>", WIDTH1, gstate.now);
|
fprintf(html_out, "<table border=1><tr><td width=%d valign=top>%.0f</td>", WIDTH1, gstate.now);
|
||||||
|
|
||||||
if (!running) {
|
if (active) {
|
||||||
|
show_resource(RSC_TYPE_CPU);
|
||||||
|
if (gpu_active) {
|
||||||
|
if (gstate.host_info.have_cuda()) {
|
||||||
|
show_resource(RSC_TYPE_CUDA);
|
||||||
|
}
|
||||||
|
if (gstate.host_info.have_ati()) {
|
||||||
|
show_resource(RSC_TYPE_ATI);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (gstate.host_info.have_cuda()) {
|
||||||
|
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
||||||
|
}
|
||||||
|
if (gstate.host_info.have_ati()) {
|
||||||
|
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
||||||
if (gstate.host_info.have_cuda()) {
|
if (gstate.host_info.have_cuda()) {
|
||||||
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
||||||
|
@ -832,15 +852,8 @@ void html_rec() {
|
||||||
if (gstate.host_info.have_ati()) {
|
if (gstate.host_info.have_ati()) {
|
||||||
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
fprintf(html_out, "<td width=%d valign=top bgcolor=#aaaaaa>OFF</td>", WIDTH2);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
show_resource(RSC_TYPE_CPU);
|
|
||||||
if (gstate.host_info.have_cuda()) {
|
|
||||||
show_resource(RSC_TYPE_CUDA);
|
|
||||||
}
|
|
||||||
if (gstate.host_info.have_ati()) {
|
|
||||||
show_resource(RSC_TYPE_ATI);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(html_out, "</tr></table>\n");
|
fprintf(html_out, "</tr></table>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,17 +1009,30 @@ void simulate() {
|
||||||
"starting simulation. delta %f duration %f", delta, duration
|
"starting simulation. delta %f duration %f", delta, duration
|
||||||
);
|
);
|
||||||
while (1) {
|
while (1) {
|
||||||
running = gstate.available.sample(gstate.now);
|
on = on_proc.sample(delta);
|
||||||
while (1) {
|
if (on) {
|
||||||
action = gstate.active_tasks.poll();
|
active = active_proc.sample(delta);
|
||||||
if (running) {
|
if (active) {
|
||||||
action |= gstate.handle_finished_apps();
|
gpu_active = gpu_active_proc.sample(delta);
|
||||||
action |= gstate.possibly_schedule_cpus();
|
} else {
|
||||||
action |= gstate.enforce_schedule();
|
gpu_active = false;
|
||||||
action |= gstate.scheduler_rpc_poll();
|
}
|
||||||
|
connected = connected_proc.sample(delta);
|
||||||
|
} else {
|
||||||
|
active = gpu_active = connected = false;
|
||||||
|
}
|
||||||
|
if (on) {
|
||||||
|
while (1) {
|
||||||
|
action = gstate.active_tasks.poll();
|
||||||
|
action |= gstate.handle_finished_apps();
|
||||||
|
gpu_suspend_reason = gpu_active?0:1;
|
||||||
|
action |= gstate.possibly_schedule_cpus();
|
||||||
|
if (connected) {
|
||||||
|
action |= gstate.scheduler_rpc_poll();
|
||||||
|
}
|
||||||
|
msg_printf(0, MSG_INFO, action?"did action":"did no action");
|
||||||
|
if (!action) break;
|
||||||
}
|
}
|
||||||
msg_printf(0, MSG_INFO, action?"did action":"did no action");
|
|
||||||
if (!action) break;
|
|
||||||
}
|
}
|
||||||
msg_printf(0, MSG_INFO, "took time step");
|
msg_printf(0, MSG_INFO, "took time step");
|
||||||
for (unsigned int i=0; i<gstate.active_tasks.active_tasks.size(); i++) {
|
for (unsigned int i=0; i<gstate.active_tasks.active_tasks.size(); i++) {
|
||||||
|
|
|
@ -77,9 +77,8 @@ class RANDOM_PROCESS {
|
||||||
public:
|
public:
|
||||||
double frac;
|
double frac;
|
||||||
double lambda;
|
double lambda;
|
||||||
int parse(XML_PARSER&, const char* end_tag);
|
bool sample(double dt);
|
||||||
bool sample(double);
|
void init(double f, double l);
|
||||||
void init(double);
|
|
||||||
RANDOM_PROCESS();
|
RANDOM_PROCESS();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -133,10 +133,8 @@ inline double exponential(double mean) {
|
||||||
return -mean*log(1-drand());
|
return -mean*log(1-drand());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RANDOM_PROCESS::sample(double t) {
|
bool RANDOM_PROCESS::sample(double diff) {
|
||||||
if (frac==1) return true;
|
if (frac==1) return true;
|
||||||
double diff = t-last_time;
|
|
||||||
last_time = t;
|
|
||||||
time_left -= diff;
|
time_left -= diff;
|
||||||
if (time_left < 0) {
|
if (time_left < 0) {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -148,23 +146,42 @@ bool RANDOM_PROCESS::sample(double t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg_printf(0, MSG_INFO,
|
msg_printf(0, MSG_INFO,
|
||||||
"value: %d lambda: %f t %f time_left %f",
|
"value: %d lambda: %f time_left %f",
|
||||||
value, lambda, t, time_left
|
value, lambda, time_left
|
||||||
);
|
);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
RANDOM_PROCESS::RANDOM_PROCESS() {
|
RANDOM_PROCESS::RANDOM_PROCESS() {
|
||||||
frac = 1;
|
frac = 1;
|
||||||
|
last_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RANDOM_PROCESS::init(double st) {
|
void RANDOM_PROCESS::init(double f, double l) {
|
||||||
last_time = st;
|
frac = f;
|
||||||
|
lambda = l;
|
||||||
|
last_time = 0;
|
||||||
value = true;
|
value = true;
|
||||||
time_left = exponential(lambda);
|
time_left = exponential(lambda);
|
||||||
off_lambda = lambda/frac - lambda;
|
off_lambda = lambda/frac - lambda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int UNIFORM_DIST::parse(XML_PARSER& xp, const char* end_tag) {
|
||||||
|
char tag[256];
|
||||||
|
bool is_tag;
|
||||||
|
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
||||||
|
if (!is_tag) return ERR_XML_PARSE;
|
||||||
|
if (xp.parse_double(tag, "lo", lo)) continue;
|
||||||
|
else if (xp.parse_double(tag, "hi", hi)) continue;
|
||||||
|
else if (!strcmp(tag, end_tag)) return 0;
|
||||||
|
else {
|
||||||
|
printf("unrecognized: %s\n", tag);
|
||||||
|
return ERR_XML_PARSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ERR_XML_PARSE;
|
||||||
|
}
|
||||||
|
|
||||||
int NORMAL_DIST::parse(XML_PARSER& xp, const char* end_tag) {
|
int NORMAL_DIST::parse(XML_PARSER& xp, const char* end_tag) {
|
||||||
char tag[256];
|
char tag[256];
|
||||||
bool is_tag;
|
bool is_tag;
|
||||||
|
@ -180,36 +197,3 @@ int NORMAL_DIST::parse(XML_PARSER& xp, const char* end_tag) {
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UNIFORM_DIST::parse(XML_PARSER& xp, const char* end_tag) {
|
|
||||||
char tag[256];
|
|
||||||
bool is_tag;
|
|
||||||
while(!xp.get(tag, sizeof(tag), is_tag)) {
|
|
||||||
if (!is_tag) return ERR_XML_PARSE;
|
|
||||||
if (xp.parse_double(tag, "lo", lo)) continue;
|
|
||||||
else if (xp.parse_double(tag, "hi", hi)) continue;
|
|
||||||
else if (!strcmp(tag, end_tag)) return 0;
|
|
||||||
else {
|
|
||||||
printf("unrecognized: %s\n", tag);
|
|
||||||
return ERR_XML_PARSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ERR_XML_PARSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int RANDOM_PROCESS::parse(XML_PARSER& xp, const char* end_tag) {
|
|
||||||
char tag[256];
|
|
||||||
bool is_tag;
|
|
||||||
while(!xp.get(tag, sizeof(tag), is_tag)) {
|
|
||||||
if (!is_tag) return ERR_XML_PARSE;
|
|
||||||
if (xp.parse_double(tag, "frac", frac)) continue;
|
|
||||||
else if (xp.parse_double(tag, "lambda", lambda)) continue;
|
|
||||||
else if (!strcmp(tag, end_tag)) return 0;
|
|
||||||
else {
|
|
||||||
printf("unrecognized: %s\n", tag);
|
|
||||||
return ERR_XML_PARSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ERR_XML_PARSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue