dgaudet     98/03/26 13:20:53

  Modified:    src      CHANGES
               src/include scoreboard.h
               src/main http_core.c http_main.c
               src/modules/standard mod_status.c
  Log:
  a few changes to scoreboard definitions to generate better code
  
  Revision  Changes    Path
  1.737     +3 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.736
  retrieving revision 1.737
  diff -u -r1.736 -r1.737
  --- CHANGES   1998/03/26 21:17:37     1.736
  +++ CHANGES   1998/03/26 21:20:46     1.737
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3b6
   
  +  *) A few changes to scoreboard definitions which helps gcc generate
  +     better code.  [Dean Gaudet]
  +
     *) ANSI C doesn't guarantee that "int foo : 2" in a structure will
        be a signed bitfield.  So mark a few bitfields as signed to
        ensure correct code.  [Dean Gaudet]
  
  
  
  1.37      +4 -5      apache-1.3/src/include/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/scoreboard.h,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- scoreboard.h      1998/01/21 19:17:44     1.36
  +++ scoreboard.h      1998/03/26 21:20:48     1.37
  @@ -68,11 +68,10 @@
    * Status values:
    */
   
  -#define SERVER_UNKNOWN (-1)  /* should never be in this state */
   #define SERVER_DEAD 0
  -#define SERVER_READY 1               /* Waiting for connection (or accept() 
lock) */
  -#define SERVER_STARTING 3    /* Server Starting up */
  -#define SERVER_BUSY_READ 2   /* Reading a client request */
  +#define SERVER_STARTING 1    /* Server Starting up */
  +#define SERVER_READY 2               /* Waiting for connection (or accept() 
lock) */
  +#define SERVER_BUSY_READ 3   /* Reading a client request */
   #define SERVER_BUSY_WRITE 4  /* Processing a client request */
   #define SERVER_BUSY_KEEPALIVE 5      /* Waiting for more requests via 
keepalive */
   #define SERVER_BUSY_LOG 6    /* Logging the request */
  @@ -101,7 +100,7 @@
       vtime_t cur_vtime;               /* the child's current vtime */
       unsigned short timeout_len;      /* length of the timeout */
   #endif
  -    signed char status;
  +    unsigned char status;
   #if defined(STATUS)
       unsigned long access_count;
       unsigned long bytes_served;
  
  
  
  1.177     +2 -2      apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.176
  retrieving revision 1.177
  diff -u -r1.176 -r1.177
  --- http_core.c       1998/03/26 21:08:37     1.176
  +++ http_core.c       1998/03/26 21:20:49     1.177
  @@ -495,7 +495,7 @@
       struct hostent *hptr;
       int hostname_lookups;
   #ifdef STATUS
  -    int old_stat = SERVER_UNKNOWN;
  +    int old_stat = SERVER_DEAD;      /* we shouldn't ever be in this state */
   #endif
   
       /* If we haven't checked the host name, and we want to */
  @@ -542,7 +542,7 @@
        }
       }
   #ifdef STATUS
  -    if (old_stat != SERVER_UNKNOWN) {
  +    if (old_stat != SERVER_DEAD) {
        (void)update_child_status(conn->child_num,old_stat,(request_rec*)NULL);
       }
   #endif /* STATUS */
  
  
  
  1.313     +22 -20    apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.312
  retrieving revision 1.313
  diff -u -r1.312 -r1.313
  --- http_main.c       1998/03/26 19:03:02     1.312
  +++ http_main.c       1998/03/26 21:20:50     1.313
  @@ -3581,35 +3581,37 @@
   
       sync_scoreboard_image();
       for (i = 0; i < daemons_limit; ++i) {
  +     int status;
  +
        if (i >= max_daemons_limit && free_length == idle_spawn_rate)
            break;
        ss = &scoreboard_image->servers[i];
  -     switch (ss->status) {
  -         /* We consider a starting server as idle because we started it
  -          * at least a cycle ago, and if it still hasn't finished starting
  -          * then we're just going to swamp things worse by forking more.
  -          * So we hopefully won't need to fork more if we count it.
  -          */
  -     case SERVER_STARTING:
  -     case SERVER_READY:
  -         ++ idle_count;
  -         /* always kill the highest numbered child if we have to...
  -          * no really well thought out reason ... other than observing
  -          * the server behaviour under linux where lower numbered children
  -          * tend to service more hits (and hence are more likely to have
  -          * their data in cpu caches).
  -          */
  -         to_kill = i;
  -         break;
  -     case SERVER_DEAD:
  +     status = ss->status;
  +     if (status == SERVER_DEAD) {
            /* try to keep children numbers as low as possible */
            if (free_length < idle_spawn_rate) {
                free_slots[free_length] = i;
                ++free_length;
            }
  -         break;
        }
  -     if (ss->status != SERVER_DEAD) {
  +     else {
  +         /* We consider a starting server as idle because we started it
  +          * at least a cycle ago, and if it still hasn't finished starting
  +          * then we're just going to swamp things worse by forking more.
  +          * So we hopefully won't need to fork more if we count it.
  +          * This depends on the ordering of SERVER_READY and SERVER_STARTING.
  +          */
  +         if (status <= SERVER_READY) {
  +             ++ idle_count;
  +             /* always kill the highest numbered child if we have to...
  +              * no really well thought out reason ... other than observing
  +              * the server behaviour under linux where lower numbered 
children
  +              * tend to service more hits (and hence are more likely to have
  +              * their data in cpu caches).
  +              */
  +             to_kill = i;
  +         }
  +
            ++total_non_dead;
            last_non_dead = i;
   #ifdef OPTIMIZE_TIMEOUTS
  
  
  
  1.82      +2 -2      apache-1.3/src/modules/standard/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_status.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- mod_status.c      1998/03/16 16:44:27     1.81
  +++ mod_status.c      1998/03/26 21:20:52     1.82
  @@ -290,10 +290,10 @@
        score_record = scoreboard_image->servers[i];
        ps_record = scoreboard_image->parent[i];
        res = score_record.status;
  -     stat_buffer[i] = (res == SERVER_UNKNOWN) ? '?' : status_flags[res];
  +     stat_buffer[i] = status_flags[res];
        if (res == SERVER_READY)
            ready++;
  -     else if (res != SERVER_DEAD && res != SERVER_UNKNOWN)
  +     else if (res != SERVER_DEAD)
            busy++;
   #if defined(STATUS)
        lres = score_record.access_count;
  
  
  

Reply via email to