Changeset 15148

Show
Ignore:
Timestamp:
05/08/08 10:48:40 (7 months ago)
Author:
davea
Message:

- scheduler: add new log flags debug_edf_sim_workload, debug_edf_sim_details

for getting info on EDF simulation;
change output from seconds to hours

- API: remove extern "C" from graphics API

(convince me it's needed before restoring)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/boinc/api/graphics2.h

    r14987 r15148  
    11#ifndef _GRAPHICS2_H_ 
    22#define _GRAPHICS2_H_ 
    3  
    4 #ifdef __cplusplus 
    5 extern "C" { 
    6 #endif 
    7  
    8  
    93 
    104// Functions that must be supplied by the app 
     
    2620extern void boinc_close_window_and_quit(); 
    2721 
    28 #ifdef __cplusplus 
    29 } 
    30 #endif 
    31  
    3222// Implementation stuff 
    3323// 
     
    3727extern bool throttled_app_render(int, int, double); 
    3828 
    39  
    4029#endif 
  • trunk/boinc/checkin_notes

    r15146 r15148  
    36993699    lib/ 
    37003700        coproc.C 
     3701 
     3702David  May 8 2008 
     3703    - scheduler: add new log flags debug_edf_sim_workload, debug_edf_sim_details 
     3704        for getting info on EDF simulation; 
     3705        change output from seconds to hours 
     3706    - API: remove extern "C" from graphics API 
     3707        (convince me it's needed before restoring) 
     3708 
     3709    api/ 
     3710        graphics2.h 
     3711    client/ 
     3712        makefile_sim 
     3713    lib/ 
     3714        diagnostics.C 
     3715    sched/ 
     3716        edf_sim.C 
     3717        sched_array.C 
     3718        sched_config.C,h 
  • trunk/boinc/client/makefile_sim

    r12604 r15148  
    1313    time_stats.o \ 
    1414    work_fetch.o \ 
    15     ../sched/edf_sim.o \ 
     15    edf_sim.o \ 
     16    ../lib/coproc.o \ 
    1617    ../lib/mfile.o \ 
    1718    ../lib/miofile.o \ 
     
    2324 
    2425sim: $(OBJS) 
    25         $(CXX) $(CXXFLAGS) $(OBJS) -o sim 
     26        $(CXX) $(CXXFLAGS) $(OBJS) -o sim -ldl 
  • trunk/boinc/lib/diagnostics.C

    r15105 r15148  
    117117 
    118118 
    119 // stub function for initializing the worker diagnostic environment. 
     119// initialize the app diagnostic environment. 
    120120// 
    121121int boinc_init_diagnostics(int _flags) { 
     
    125125 
    126126 
    127 // stub function for initializing the graphic diagnostic environment. 
     127// initialize the graphic diagnostic environment. 
    128128// 
    129129int boinc_init_graphics_diagnostics(int _flags) { 
    130     int modified_flags = BOINC_DIAG_BOINCAPPLICATION | _flags; 
    131     return diagnostics_init(modified_flags, BOINC_DIAG_GFX_STDOUT, BOINC_DIAG_GFX_STDERR); 
     130    return diagnostics_init( 
     131        BOINC_DIAG_BOINCAPPLICATION | _flags, 
     132        BOINC_DIAG_GFX_STDOUT, BOINC_DIAG_GFX_STDERR 
     133    ); 
    132134} 
    133135 
  • trunk/boinc/sched/edf_sim.C

    r14811 r15148  
    2727#endif 
    2828 
     29#ifdef SIM 
     30#include <stdarg.h> 
     31#else 
     32#include "sched_config.h" 
     33#include "sched_msgs.h" 
     34#endif 
     35 
    2936#include "edf_sim.h" 
    3037 
    3138using std::vector; 
    3239 
    33 //#define TEST 
    34 //#define DEBUG 
    35  
    36 // 0 shows initial workload and candidate decisions 
    37 // 1 shows function calls results of sim: make/miss deadline 
    38 // 2 shows every step of sim 
     40#define SUMMARY 0 
     41    // show candidate decision 
     42#define WORKLOAD  1 
     43    // show workload 
     44#define DETAIL   2 
     45    // show every step of simulation 
     46 
     47static void log_msg(int level, const char* format, ...) { 
     48#ifdef SIM 
     49#else 
     50    switch(level) { 
     51    case SUMMARY: 
     52        if (!config.debug_send) return; 
     53        break; 
     54    case WORKLOAD: 
     55        if (!config.debug_edf_sim_workload) return; 
     56        break; 
     57    case DETAIL: 
     58        if (!config.debug_edf_sim_detail) return; 
     59        break; 
     60    } 
     61#endif 
     62    va_list va; 
     63    va_start(va, format); 
     64#ifdef SIM 
     65    vfprintf(stderr, format, va); 
     66#else 
     67    log_messages.vprintf(MSG_DEBUG, format, va); 
     68#endif 
     69    va_end(va); 
     70
    3971 
    4072bool lessthan_deadline(const IP_RESULT& p1, const IP_RESULT& p2) { 
     
    5183    int j; 
    5284 
    53 #ifdef DEBUG 
    54     fprintf(stderr, "mark_edf_misses\n"); 
    55 #endif 
     85    log_msg(DETAIL, "mark_edf_misses\n"); 
    5686 
    5787    // keeps track of when each cpu is next free 
     
    82112       
    83113        booked_to[lowest_booked_cpu] += r.cpu_time_remaining; 
    84 #ifdef DEBUG 
    85         fprintf(stderr, "  running %s on cpu %d; finishes at %f\n", 
    86             r.name, lowest_booked_cpu, booked_to[lowest_booked_cpu] 
     114        log_msg(DETAIL, "  running %s on cpu %d; finishes at %.2f\n", 
     115            r.name, lowest_booked_cpu, booked_to[lowest_booked_cpu]/3600 
    87116        ); 
    88 #endif 
    89117        if (booked_to[lowest_booked_cpu] > r.computation_deadline) { 
    90118                r.misses_deadline = true; 
    91119                r.estimated_completion_time = booked_to[lowest_booked_cpu]; 
    92 #ifdef DEBUG 
    93                 fprintf(stderr, "  %s misses_deadline; est completion %f\n", 
    94                 r.name, booked_to[lowest_booked_cpu] 
     120                log_msg(DETAIL, "  %s misses_deadline; est completion %.2f\n", 
     121                r.name, booked_to[lowest_booked_cpu]/3600 
    95122            ); 
    96 #endif 
    97123        } else { 
    98124                r.misses_deadline = false; 
    99 #ifdef DEBUG 
    100                 fprintf(stderr, "  %s makes deadline; est completion %f\n", 
    101                 r.name, booked_to[lowest_booked_cpu] 
     125                log_msg(DETAIL, "  %s makes deadline; est completion %.2f\n", 
     126                r.name, booked_to[lowest_booked_cpu]/3600 
    102127            ); 
    103 #endif 
    104128                // if result doesn't miss its deadline, 
    105129            // then the estimated_completion_time is of no use 
     
    108132} 
    109133 
    110 // For each ip_result, computes computation_deadline from report_deadline, 
    111 // and determines if the deadline would be missed by simulating edf 
     134// For each ip_result, compute computation_deadline from report_deadline, 
     135// and determine if the deadline would be missed by simulating EDF 
    112136// 
    113137void init_ip_results( 
     
    118142    unsigned int i; 
    119143 
    120 #ifdef DEBUG 
    121     fprintf(stderr, "init_ip_results; work_buf_min %f ncpus %d:\n", work_buf_min, ncpus); 
    122 #endif 
     144    log_msg(DETAIL, 
     145        "init_ip_results; work_buf_min %.2f ncpus %d:\n", 
     146        work_buf_min/3600, ncpus 
     147    ); 
    123148    for (i=0; i<ip_results.size(); i++) { 
    124149        IP_RESULT& r = ip_results[i]; 
    125150        r.computation_deadline = r.report_deadline - work_buf_min; 
    126 #ifdef DEBUG 
    127         fprintf(stderr, "    %s: deadline %.2f cpu %.2f\n", 
    128             r.name, r.computation_deadline, r.cpu_time_remaining 
     151        log_msg(DETAIL, "    %s: deadline %.2f cpu %.2f\n", 
     152            r.name, r.computation_deadline/3600, r.cpu_time_remaining/3600 
    129153        ); 
    130 #endif 
    131154    } 
    132155 
     
    199222    int j; 
    200223 
    201 #ifdef DEBUG 
    202     fprintf(stderr, "check_candidate %s: dl %f cpu %f\n", 
    203         candidate.name, candidate.computation_deadline, 
    204         candidate.cpu_time_remaining 
     224    log_msg(DETAIL, "check_candidate %s: dl %.2f cpu %.2f\n", 
     225        candidate.name, candidate.computation_deadline/3600, 
     226        candidate.cpu_time_remaining/3600 
    205227    ); 
    206 #endif 
    207228 
    208229    for (j=0; j<ncpus; j++) { 
     
    231252        } 
    232253        booked_to[lowest_booked_cpu] += r.cpu_time_remaining; 
    233 #ifdef DEBUG 
    234         fprintf(stderr, "  running %s on cpu %d; finishes at %f\n", 
    235             r.name, lowest_booked_cpu, booked_to[lowest_booked_cpu] 
     254        log_msg(DETAIL, "  running %s on cpu %d; finishes at %.2f\n", 
     255            r.name, lowest_booked_cpu, booked_to[lowest_booked_cpu]/3600 
    236256        ); 
    237 #endif 
    238257 
    239258        // return false if completion time if > computation_deadline AND 
     
    243262            && !r.misses_deadline 
    244263        ) { 
    245 #ifdef DEBUG 
    246                 fprintf(stderr, "  cand. fails; %s now misses deadline: %f > %f\n", 
    247                 r.name, booked_to[lowest_booked_cpu], r.computation_deadline 
     264                log_msg(SUMMARY, 
     265                "  cand. fails; %s now misses deadline: %.2f > %.2f\n", 
     266                r.name, booked_to[lowest_booked_cpu]/3600, 
     267                r.computation_deadline/3600 
    248268            ); 
    249 #endif 
    250269            return false; 
    251270        } 
     
    256275            && booked_to[lowest_booked_cpu] > r.estimated_completion_time 
    257276        ){ 
    258 #ifdef DEBUG 
    259             fprintf(stderr, "  cand. fails; late result %s to be returned even later\n", r.name); 
    260 #endif 
     277            log_msg(SUMMARY, 
     278                "  cand. fails; late result %s would be returned even later\n", 
     279                r.name 
     280            ); 
    261281            return false; 
    262282        } 
    263283    } 
    264 #ifdef DEBUG 
    265     fprintf(stderr, "  cand. succeeds\n"); 
    266 #endif 
     284    log_msg(SUMMARY, "  cand. succeeds\n"); 
    267285    return true; 
    268286} 
    269287 
    270 #ifdef TEST 
     288#if 0 
    271289int main() { 
    272290    vector<IP_RESULT> ip_results; 
  • trunk/boinc/sched/sched_array.C

    r15109 r15148  
    134134        retval = wu_is_infeasible_fast(wu, sreq, reply, *app); 
    135135        if (retval) { 
    136             log_messages.printf(MSG_DEBUG, 
    137                 "[HOST#%d] [WU#%d %s] WU is infeasible: %s\n", 
    138                 reply.host.id, wu.id, wu.name, infeasible_string(retval) 
    139             ); 
     136            if (config.debug_send) { 
     137                log_messages.printf(MSG_DEBUG, 
     138                    "[HOST#%d] [WU#%d %s] WU is infeasible: %s\n", 
     139                    reply.host.id, wu.id, wu.name, infeasible_string(retval) 
     140                ); 
     141            } 
    140142            continue; 
    141143        } 
  • trunk/boinc/sched/sched_config.C

    r15136 r15148  
    194194        if (xp.parse_bool(tag, "debug_request_details", debug_request_details)) continue; 
    195195        if (xp.parse_bool(tag, "debug_handle_results", debug_handle_results)) continue; 
     196        if (xp.parse_bool(tag, "debug_edf_sim_workload", debug_edf_sim_workload)) continue; 
     197        if (xp.parse_bool(tag, "debug_edf_sim_detail", debug_edf_sim_detail)) continue; 
    196198 
    197199        // don't complain about unparsed XML; 
  • trunk/boinc/sched/sched_config.h

    r15136 r15148  
    132132    bool debug_request_details; 
    133133    bool debug_handle_results; 
     134    bool debug_edf_sim_workload;    // show workload for EDF sim 
     135    bool debug_edf_sim_detail;      // show details of EDF sim 
    134136 
    135137    int parse(FILE*); 

If this page is incomplete or incorrect, please edit it or add it to the wiki to-do list. To do this, you must be logged in; click Login or Register above.