// 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 .
// logic for handling the HR info file (hr_info.txt)
// which is written by census.cpp
// and used by the feeder to assign job array slots to HR classes
#include "hr_info.h"
#ifndef _USING_FCGI_
#include
#else
#include "boinc_fcgi.h"
#endif
#include
#include "error_numbers.h"
#include "sched_msgs.h"
int HR_INFO::write_file() {
int i, j;
#ifndef _USING_FCGI_
FILE* f = fopen(HR_INFO_FILENAME, "w");
#else
FCGI_FILE* f = FCGI::fopen(HR_INFO_FILENAME, "w");
#endif
if (!f) return ERR_FOPEN;
for (i=1; i1");
if (retval) break;
if (host.p_fpops > 1e7 && host.p_fpops < 1e13) {
n++;
sum += host.p_fpops;
sum_sqr += host.p_fpops*host.p_fpops;
}
//printf("host %d: %s | %s | %s\n", host.id, host.os_name, host.p_vendor, host.p_model);
for (i=1; i 1) {
log_messages.printf(MSG_DEBUG,
"type %d class %d: allocating %d slots\n", i, j, n
);
}
}
for (j=0; j= max_slots[hrt][hrc]) {
log_messages.printf(MSG_DEBUG,
"skipping job because HR class (%d, %d) full\n", hrt, hrc
);
return false;
}
cur_slots[hrt][hrc]++;
return true;
}
void HR_INFO::show(FILE* f) {
for (int ht=1; ht