diff --git a/checkin_notes b/checkin_notes index c37aeedb2b..edf55fe18f 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6708,3 +6708,9 @@ David 25 June 2007 clientgui/ ViewWork.cpp ViewWorkGrid.cpp + +David 25 June 2007 + - added hr_info.* + + sched/ + hr_info.C,h diff --git a/sched/hr_info.C b/sched/hr_info.C new file mode 100644 index 0000000000..8237134077 --- /dev/null +++ b/sched/hr_info.C @@ -0,0 +1,150 @@ +#include +#include + +#include "error_numbers.h" +#include "sched_msgs.h" + +#include "hr_info.h" + +int HR_INFO::write_file() { + int i, j; + + FILE* f = fopen(HR_INFO_FILENAME, "w"); + if (!f) return ERR_FOPEN; + for (i=1; i1"); + if (retval) break; + 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(SCHED_MSG_LOG::MSG_DEBUG, + "type %d class %d: allocating %d slots\n", i, j, n + ); + } + } + for (j=0; j= max_slots[hrt][hrc]) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "skipping job because HR class (%d, %d) full\n", hrt, hrc + ); + return false; + } + cur_slots[hrt][hrc]++; +} diff --git a/sched/hr_info.h b/sched/hr_info.h new file mode 100644 index 0000000000..13717aa010 --- /dev/null +++ b/sched/hr_info.h @@ -0,0 +1,25 @@ +#include "hr.h" + +struct HR_INFO { + double *rac_per_class[HR_NTYPES]; + // how much RAC per class + int *max_slots[HR_NTYPES]; + // max # of work array slots per class + int *cur_slots[HR_NTYPES]; + // estimate of current # of slots used for per class + double type_weights[HR_NTYPES]; + // total app weight per type + int slots_per_type[HR_NTYPES]; + // # of slots per type (fixed at start) + bool type_being_used[HR_NTYPES]; + // whether any app is actually using this HR type + int write_file(); + int read_file(); + void scan_db(); + void allot(); + void init(); + void allocate(int); + bool accept(int, int); +}; + +#define HR_INFO_FILENAME "../hr_info.txt"