jim         96/07/12 18:47:41

  Modified:    src       http_main.c mod_status.c scoreboard.h
  Log:
  add process-time and prevent rollover
  
  Revision  Changes    Path
  1.47      +14 -9     apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -C3 -r1.46 -r1.47
  *** http_main.c       1996/07/10 13:50:42     1.46
  --- http_main.c       1996/07/13 01:47:36     1.47
  ***************
  *** 97,102 ****
  --- 97,103 ----
    extern int  shmctl(int, int, struct shmid_ds *);
    extern int  shmget(key_t, int, int);
    extern char *sbrk(int);
  + #include <sys/time.h>
    #endif
    #endif
    #ifdef SecureWare
  ***************
  *** 749,754 ****
  --- 750,756 ----
        new_score_rec.my_bytes_served = 0L;
        new_score_rec.conn_count = (unsigned short)0;
        new_score_rec.conn_bytes = (unsigned long)0;
  +     new_score_rec.how_long = (unsigned short)0;
        }
        if (r) {
        int slot_size;
  ***************
  *** 806,811 ****
  --- 808,814 ----
    void increment_counts (int child_num, request_rec *r, int flag)
    {
        long int bs=0;
  +     time_t now;
        short_score new_score_rec=scoreboard_image[child_num];
    
        if (r->sent_bodyct)
  ***************
  *** 824,829 ****
  --- 827,835 ----
    
        times(&new_score_rec.times);
    
  +     now=time(NULL);
  +     new_score_rec.how_long = now - new_score_rec.last_used;
  + 
    #if defined(HAVE_MMAP) || defined(HAVE_SHMGET)
        memcpy(&scoreboard_image[child_num], &new_score_rec, 
sizeof(short_score));
    #else
  ***************
  *** 1298,1317 ****
        r = read_request (current_conn);
        (void)update_child_status (child_num, SERVER_BUSY_WRITE, r);
        if (r) process_request (r); /* else premature EOF --- ignore */
  - 
    #if defined(STATUS)
            if (r) increment_counts(child_num,r,1);
    #endif
        while (r && current_conn->keepalive) {
  !       bflush(conn_io);
  !       destroy_pool(r->pool);
  !       (void)update_child_status (child_num, SERVER_BUSY_KEEPALIVE, 
(request_rec*)NULL);
  !       r = read_request (current_conn);
  !       (void)update_child_status (child_num, SERVER_BUSY_WRITE, r);
  !       if (r) process_request (r);
  ! 
    #if defined(STATUS)
  !       if (r) increment_counts(child_num,r,0);
    #endif
        }
    #if 0       
  --- 1304,1322 ----
        r = read_request (current_conn);
        (void)update_child_status (child_num, SERVER_BUSY_WRITE, r);
        if (r) process_request (r); /* else premature EOF --- ignore */
    #if defined(STATUS)
            if (r) increment_counts(child_num,r,1);
    #endif
        while (r && current_conn->keepalive) {
  !         bflush(conn_io);
  !         destroy_pool(r->pool);
  !         (void)update_child_status (child_num, SERVER_BUSY_KEEPALIVE,
  !          (request_rec*)NULL);
  !         r = read_request (current_conn);
  !         (void)update_child_status (child_num, SERVER_BUSY_WRITE, r);
  !         if (r) process_request (r);
    #if defined(STATUS)
  !         if (r) increment_counts(child_num,r,0);
    #endif
        }
    #if 0       
  
  
  
  1.26      +29 -11    apache/src/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_status.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -C3 -r1.25 -r1.26
  *** mod_status.c      1996/06/29 22:23:25     1.25
  --- mod_status.c      1996/07/13 01:47:38     1.26
  ***************
  *** 116,121 ****
  --- 116,131 ----
        rprintf(r,"%.1f GB",(float)bytes/GBYTE);
    }
    
  + void format_kbyte_out(request_rec *r,unsigned long kbytes)
  + {
  +     if (kbytes < KBYTE)
  +     rprintf(r,"%d kB",(int)kbytes);
  +     else if (kbytes < MBYTE)
  +     rprintf(r,"%.1f MB",(float)kbytes/KBYTE);
  +     else
  +     rprintf(r,"%.1f GB",(float)kbytes/MBYTE);
  + }
  + 
    void show_time(request_rec *r,time_t tsecs)
    {
        long days,hrs,mins,secs;
  ***************
  *** 186,191 ****
  --- 196,202 ----
        unsigned long my_lres,my_bytes,conn_bytes;
        unsigned short conn_lres;
        unsigned long bcount=0;
  +     unsigned long kbcount=0;
    #ifdef NEXT
        float tick=HZ;
    #else
  ***************
  *** 277,282 ****
  --- 288,297 ----
            tcs+=score_record.times.tms_cstime;
                count+=lres;
            bcount+=bytes;
  +         if (bcount>=KBYTE) {
  +             kbcount += (bcount >> 10);
  +             bcount = bcount & 0x3ff;
  +         }
        }
    #endif /* STATUS */
        }
  ***************
  *** 299,305 ****
    #if defined(STATUS)
        if (short_report)
        {
  !         rprintf(r,"Total Accesses: %lu\nTotal Bytes: %lu\n",count,bcount);
    
        if(ts || tu || tcu || tcs)
            rprintf(r,"CPULoad: %g\n",(tu+ts+tcu+tcs)/tick/up_time*100.);
  --- 314,320 ----
    #if defined(STATUS)
        if (short_report)
        {
  !         rprintf(r,"Total Accesses: %lu\nTotal kBytes: %lu\n",count,kbcount);
    
        if(ts || tu || tcu || tcs)
            rprintf(r,"CPULoad: %g\n",(tu+ts+tcu+tcs)/tick/up_time*100.);
  ***************
  *** 309,322 ****
            rprintf(r,"ReqPerSec: %g\n",(float)count/(float)up_time);
    
        if (up_time>0)
  !         rprintf(r,"BytesPerSec: %g\n",(float)bcount/(float)up_time);
    
        if (count>0)
  !         rprintf(r,"BytesPerReq: %g\n",(float)bcount/(float)count);
        } else /* !short_report */
        {
        rprintf(r,"Total accesses: %lu - Total Traffic: ", count);
  !     format_byte_out(r,bcount);
        rputs("<br>\n",r);
            rprintf(r,"CPU Usage: u%g s%g cu%g cs%g",
                tu/tick,ts/tick,tcu/tick,tcs/tick);
  --- 324,337 ----
            rprintf(r,"ReqPerSec: %g\n",(float)count/(float)up_time);
    
        if (up_time>0)
  !         rprintf(r,"BytesPerSec: %g\n",KBYTE*(float)kbcount/(float)up_time);
    
        if (count>0)
  !         rprintf(r,"BytesPerReq: %g\n",KBYTE*(float)kbcount/(float)count);
        } else /* !short_report */
        {
        rprintf(r,"Total accesses: %lu - Total Traffic: ", count);
  !     format_kbyte_out(r,kbcount);
        rputs("<br>\n",r);
            rprintf(r,"CPU Usage: u%g s%g cu%g cs%g",
                tu/tick,ts/tick,tcu/tick,tcs/tick);
  ***************
  *** 332,344 ****
    
        if (up_time>0)
        {
  !         format_byte_out(r,(float)bcount/(float)up_time);
            rputs("/second - ",r);
        }
    
        if (count>0)
        {
  !         format_byte_out(r,(float)bcount/(float)count);
            rputs("/request",r);
        }
    
  --- 347,359 ----
    
        if (up_time>0)
        {
  !         format_byte_out(r,KBYTE*(float)kbcount/(float)up_time);
            rputs("/second - ",r);
        }
    
        if (count>0)
        {
  !         format_byte_out(r,KBYTE*(float)kbcount/(float)count);
            rputs("/request",r);
        }
    
  ***************
  *** 386,392 ****
                if(no_table_report)
                rputs("<p><hr><h2>Server Details</h2>\n\n",r);
        else
  !             rputs("<p>\n\n<table 
border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Conn<th>Child<th>Slot<th>Host<th>Request</tr>\n\n",r);
    
    
        for (i = 0; i<HARD_SERVER_LIMIT; ++i)
  --- 401,407 ----
                if(no_table_report)
                rputs("<p><hr><h2>Server Details</h2>\n\n",r);
        else
  !             rputs("<p>\n\n<table 
border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Ptime<th>Conn<th>Child<th>Slot<th>Host<th>Request</tr>\n\n",r);
    
    
        for (i = 0; i<HARD_SERVER_LIMIT; ++i)
  ***************
  *** 435,446 ****
                            rputs("Dead",r);
                            break;
                    }
  !                 rprintf(r,"] u%g s%g cu%g cs%g\n %s (",
                            score_record.times.tms_utime/tick,
                            score_record.times.tms_stime/tick,
                            score_record.times.tms_cutime/tick,
                            score_record.times.tms_cstime/tick,
  !                         asctime(localtime(&score_record.last_used)));
                    format_byte_out(r,conn_bytes);
                    rputs("|",r);
                    format_byte_out(r,my_bytes);
  --- 450,462 ----
                            rputs("Dead",r);
                            break;
                    }
  !                 rprintf(r,"] u%g s%g cu%g cs%g\n %s (%d",
                            score_record.times.tms_utime/tick,
                            score_record.times.tms_stime/tick,
                            score_record.times.tms_cutime/tick,
                            score_record.times.tms_cstime/tick,
  !                         asctime(localtime(&score_record.last_used)),
  !                         (int)score_record.how_long);
                    format_byte_out(r,conn_bytes);
                    rputs("|",r);
                    format_byte_out(r,my_bytes);
  ***************
  *** 482,493 ****
                            rputs("<td>.",r);
                            break;
                    }
  !                 rprintf(r,"\n<td>%.2f<td>%.0f",
                            (score_record.times.tms_utime +
                            score_record.times.tms_stime +
                            score_record.times.tms_cutime +
                            score_record.times.tms_cstime)/tick,
  !                         difftime(nowtime, score_record.last_used));
                    rprintf(r,"<td>%-1.1f<td>%-2.2f<td>%-2.2f\n",
                        (float)conn_bytes/KBYTE, (float)my_bytes/MBYTE,
                        (float)bytes/MBYTE);
  --- 498,510 ----
                            rputs("<td>.",r);
                            break;
                    }
  !                 rprintf(r,"\n<td>%.2f<td>%.0f<td>%d",
                            (score_record.times.tms_utime +
                            score_record.times.tms_stime +
                            score_record.times.tms_cutime +
                            score_record.times.tms_cstime)/tick,
  !                         difftime(nowtime, score_record.last_used),
  !                         (int)score_record.how_long);
                    rprintf(r,"<td>%-1.1f<td>%-2.2f<td>%-2.2f\n",
                        (float)conn_bytes/KBYTE, (float)my_bytes/MBYTE,
                        (float)bytes/MBYTE);
  ***************
  *** 509,514 ****
  --- 526,532 ----
    <tr><th>M<td>Mode of operation\n \
    <tr><th>CPU<td>CPU usage, number of seconds\n \
    <tr><th>SS<td>Seconds since beginning of most recent request\n \
  + <tr><th>Ptime<td>Seconds to process the recent request\n \
    <tr><th>Conn<td>Kilobytes transferred this connection\n \
    <tr><th>Child<td>Megabytes transferred this child\n \
    <tr><th>Slot<td>Total megabytes transferred this slot\n \
  
  
  
  1.13      +1 -0      apache/src/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/scoreboard.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -C3 -r1.12 -r1.13
  *** scoreboard.h      1996/06/07 17:39:26     1.12
  --- scoreboard.h      1996/07/13 01:47:38     1.13
  ***************
  *** 83,88 ****
  --- 83,89 ----
        unsigned long my_bytes_served;
        unsigned long conn_bytes;
        unsigned short conn_count;
  +     unsigned short how_long;
        struct tms times;
        time_t last_used;
        char client[32];        /* Keep 'em small... */
  
  
  

Reply via email to