Changeset 7824


Ignore:
Timestamp:
Dec 5, 2007, 2:14:04 PM (13 years ago)
Author:
gb
Message:

Use commas when printing bytes allocated/freed in GC messages; try to
make fields in before/after GC messages line up.

Location:
trunk/ccl/lisp-kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/ppc-gc.c

    r7137 r7824  
    2525#include <string.h>
    2626#include <sys/time.h>
     27
     28void
     29comma_output_decimal(char *buf, int len, natural n)
     30{
     31  int nout = 0;
     32
     33  buf[--len] = 0;
     34  do {
     35    buf[--len] = n%10+'0';
     36    n = n/10;
     37    if (n == 0) {
     38      while (len) {
     39        buf[--len] = ' ';
     40      }
     41      return;
     42    }
     43    if (len == 0) return;
     44    nout ++;
     45    if (nout == 3) {
     46      buf[--len] = ',';
     47      nout = 0;
     48    }
     49  } while (len >= 0);
     50}
    2751
    2852/* Heap sanity checking. */
     
    24852509
    24862510  if (GCverbose) {
     2511    char buf[16];
     2512
     2513    comma_output_decimal(buf,16,area_dnode(oldfree,a->low) << dnode_shift);
    24872514    if (GCephemeral_low) {
    24882515      fprintf(stderr,
    2489               "\n\n;;; Starting Ephemeral GC of generation %d",
     2516              "\n\n;;; Starting EGC of generation %d",
    24902517              (from == g2_area) ? 2 : (from == g1_area) ? 1 : 0);
    24912518    } else {
    24922519      fprintf(stderr,"\n\n;;; Starting full GC");
    24932520    }
    2494     fprintf(stderr, ",  %ld bytes allocated.\n", area_dnode(oldfree,a->low) << dnode_shift);
     2521    fprintf(stderr, ", %s bytes allocated.\n", buf);
    24952522  }
    24962523
     
    27982825      *( (long long *) ptr_from_lispobj(((macptr *) ptr_from_lispobj(untag(val)))->address)) += justfreed;
    27992826      if (GCverbose) {
     2827        char buf[16];
    28002828        if (justfreed <= heap_segment_size) {
    28012829          justfreed = 0;
    28022830        }
    28032831        if (note == tenured_area) {
    2804           fprintf(stderr,";;; Finished full GC.  Freed %lld bytes in %d.%06d s\n\n", justfreed, elapsed.tv_sec, elapsed.tv_usec);
     2832          fprintf(stderr,";;; Finished full GC. %s bytes freed in %d.%06d s\n\n", buf, elapsed.tv_sec, elapsed.tv_usec);
    28052833        } else {
    2806           fprintf(stderr,";;; Finished Ephemeral GC of generation %d.  Freed %lld bytes in %d.%06d s\n\n",
     2834          fprintf(stderr,";;; Finished EGC of generation %d. %s bytes freed in %d.%06d s\n\n",
    28072835                  (from == g2_area) ? 2 : (from == g1_area) ? 1 : 0,
    2808                   justfreed,
     2836                  buf,
    28092837                  elapsed.tv_sec, elapsed.tv_usec);
    28102838        }
  • trunk/ccl/lisp-kernel/x86-gc.c

    r7137 r7824  
    5050#endif
    5151
     52
     53void
     54comma_output_decimal(char *buf, int len, natural n)
     55{
     56  int nout = 0;
     57
     58  buf[--len] = 0;
     59  do {
     60    buf[--len] = n%10+'0';
     61    n = n/10;
     62    if (n == 0) {
     63      while (len) {
     64        buf[--len] = ' ';
     65      }
     66      return;
     67    }
     68    if (len == 0) return;
     69    nout ++;
     70    if (nout == 3) {
     71      buf[--len] = ',';
     72      nout = 0;
     73    }
     74  } while (len >= 0);
     75}
    5276
    5377/* Heap sanity checking. */
     
    24172441
    24182442  if (GCverbose) {
     2443    char buf[16];
     2444   
     2445    comma_output_decimal(buf,16,area_dnode(oldfree,a->low) << dnode_shift);
    24192446    if (GCephemeral_low) {
    24202447      fprintf(stderr,
    2421               "\n\n;;; Starting Ephemeral GC of generation %d",
     2448              "\n\n;;; Starting EGC of generation %d",
    24222449              (from == g2_area) ? 2 : (from == g1_area) ? 1 : 0);
    24232450    } else {
    24242451      fprintf(stderr,"\n\n;;; Starting full GC");
    24252452    }
    2426     fprintf(stderr, ",  %ld bytes allocated.\n", area_dnode(oldfree,a->low) << dnode_shift);
     2453    fprintf(stderr, ", %s bytes allocated.\n", buf);
    24272454  }
    24282455
     
    27122739      *( (long long *) ptr_from_lispobj(((macptr *) ptr_from_lispobj(untag(val)))->address)) += justfreed;
    27132740      if (GCverbose) {
     2741        char buf[16];
    27142742        if (justfreed <= heap_segment_size) {
    27152743          justfreed = 0;
    27162744        }
     2745        comma_output_decimal(buf,16,justfreed);
    27172746        if (note == tenured_area) {
    2718           fprintf(stderr,";;; Finished full GC.  Freed %lld bytes in %d.%06d s\n\n", justfreed, elapsed.tv_sec, elapsed.tv_usec);
     2747          fprintf(stderr,";;; Finished full GC. %s bytes freed in %d.%06d s\n\n", buf, elapsed.tv_sec, elapsed.tv_usec);
    27192748        } else {
    2720           fprintf(stderr,";;; Finished Ephemeral GC of generation %d.  Freed %lld bytes in %d.%06d s\n\n",
     2749          fprintf(stderr,";;; Finished EGC of generation %d. %s bytes freed in %d.%06d s\n\n",
    27212750                  (from == g2_area) ? 2 : (from == g1_area) ? 1 : 0,
    2722                   justfreed,
     2751                  buf,
    27232752                  elapsed.tv_sec, elapsed.tv_usec);
    27242753        }
Note: See TracChangeset for help on using the changeset viewer.