示例#1
0
// see if we're using HR, and if so initialize the necessary data structures
//
void hr_init() {
    int i, retval;
    bool apps_differ = false;
    bool some_app_uses_hr = false;
    int hrt, hr_type0 = ssp->apps[0].homogeneous_redundancy;

    using_hr = false;

    for (i=0; i<ssp->napps; i++) {
        hrt = ssp->apps[i].homogeneous_redundancy;
        if (hrt <0 || hrt >= HR_NTYPES) {
            log_messages.printf(MSG_CRITICAL,
                "HR type %d out of range for app %d\n", hrt, i
            );
            exit(1);
        }
        if (hrt) some_app_uses_hr = true;
        if (hrt != hr_type0) apps_differ = true;
    }
    if (config.homogeneous_redundancy) {
        log_messages.printf(MSG_NORMAL,
            "config HR is %d\n", config.homogeneous_redundancy
        );
        hrt = config.homogeneous_redundancy;
        if (hrt < 0 || hrt >= HR_NTYPES) {
            log_messages.printf(MSG_CRITICAL,
                "Main HR type %d out of range\n", hrt
            );
            exit(1);
        }
        if (some_app_uses_hr) {
            log_messages.printf(MSG_CRITICAL,
                "You can specify HR at global or app level, but not both\n"
            );
            exit(1);
        }
        for (i=0; i<ssp->napps; i++) {
            ssp->apps[i].homogeneous_redundancy = config.homogeneous_redundancy;
            ssp->apps[i].weight = 1;
        }

    } else {
        if (some_app_uses_hr) {
            if (apps_differ && !all_apps) {
                log_messages.printf(MSG_CRITICAL,
                    "You must use --allapps if apps have different HR\n"
                );
                exit(1);
            }
        } else {
            return;     // HR not being used
        }
    }
    using_hr = true;
    if (config.hr_allocate_slots) {
        hr_info.init();
        retval = hr_info.read_file();
        if (retval) {
            log_messages.printf(MSG_CRITICAL,
                "Can't read HR info file: %s\n", boincerror(retval)
            );
            exit(1);
        }

        // find the weight for each HR type
        //
        for (i=0; i<ssp->napps; i++) {
            hrt = ssp->apps[i].homogeneous_redundancy;
            hr_info.type_weights[hrt] += ssp->apps[i].weight;
            hr_info.type_being_used[hrt] = true;
        }

        // compute the slot allocations for HR classes
        //
        hr_info.allocate(ssp->max_wu_results);
        hr_info.show(stderr);
    }
}
示例#2
0
// write a summary of feeder state to stderr
//
void show_state(int) {
    ssp->show(stderr);
    if (config.hr_allocate_slots) {
        hr_info.show(stderr);
    }
}
示例#3
0
// write a summary of feeder state to stderr
//
void show_state(int) {
    ssp->show(stderr);
    hr_info.show(stderr);
}