Changeset 530 for trunk/src/gmake/main.c


Ignore:
Timestamp:
Sep 17, 2006, 10:38:57 PM (19 years ago)
Author:
bird
Message:

Added kBuild specific functions for speeding up source processing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/main.c

    r522 r530  
    282282
    283283struct variable shell_var;
     284
     285#ifdef KMK
     286/* Process priority.
     287    0 = no change;
     288    1 = idle / max nice;
     289    2 = below normal /  nice 10;
     290    3 = normal / nice 0;
     291    4 = high / nice -10;
     292    4 = realtime / nice -19; */
     293int process_priority = 0;
     294#endif
    284295
    285296
     
    402413    { 'p', flag, (char *) &print_data_base_flag, 1, 1, 0, 0, 0,
    403414      "print-data-base" },
     415#ifdef KMK
     416    { CHAR_MAX+5, positive_int, (char *) &process_priority, 1, 1, 0, 0, 0,
     417      "priority" },
     418#endif
    404419    { 'q', flag, (char *) &question_flag, 1, 1, 1, 0, 0, "question" },
    405420    { 'r', flag, (char *) &no_builtin_rules_flag, 1, 1, 0, 0, 0,
     
    667682    }
    668683}
     684
     685
     686#ifdef KMK
     687static void
     688set_make_priority (void)
     689{
     690#ifdef WINDOWS32
     691    DWORD dwPriority;
     692    switch (process_priority)
     693      {
     694        case 0:     return;
     695        case 1:     dwPriority = IDLE_PRIORITY_CLASS; break;
     696        case 2:     dwPriority = BELOW_NORMAL_PRIORITY_CLASS; break;
     697        case 3:     dwPriority = NORMAL_PRIORITY_CLASS; break;
     698        case 4:     dwPriority = HIGH_PRIORITY_CLASS; break;
     699        case 5:     dwPriority = REALTIME_PRIORITY_CLASS; break;
     700        default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
     701      }
     702    SetPriorityClass(GetCurrentProcess(), dwPriority);
     703#else /*#elif HAVE_NICE */
     704    int nice = 0;
     705    switch (process_priority)
     706      {
     707        case 0:     return;
     708        case 1:     nice = 19; break;
     709        case 2:     nice = 10; break;
     710        case 3:     nice = 0; break;
     711        case 4:     nice = -10; break;
     712        case 5:     nice = -19; break;
     713        default:    fatal(NILF, _("invalid priority %d\n"), process_priority);
     714      }
     715    nice(nice);
     716#endif
     717}
     718#endif
     719
    669720
    670721#ifdef WINDOWS32
     
    12771328
    12781329  decode_debug_flags ();
     1330
     1331#ifdef KMK
     1332  set_make_priority ();
     1333#endif
    12791334
    12801335  /* Set always_make_flag if -B was given and we've not restarted already.  */
Note: See TracChangeset for help on using the changeset viewer.