Back to index

plt-scheme  4.2.1
Defines | Typedefs | Functions
gc2_dump.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define GC_DUMP_SHOW_DETAILS   0x1
#define GC_DUMP_SHOW_TRACE   0x2
#define GC_DUMP_SHOW_FINALS   0x4

Typedefs

typedef char *(* GC_get_type_name_proc )(short t)
typedef char *(* GC_get_xtagged_name_proc )(void *p)
typedef void(* GC_for_each_found_proc )(void *p)
typedef void(* GC_print_tagged_value_proc )(const char *prefix, void *v, int xtagged, unsigned long diff, int max_w, const char *suffix)

Functions

GC2_EXTERN void GC_dump_with_traces (int flags, GC_get_type_name_proc get_type_name, GC_get_xtagged_name_proc get_xtagged_name, GC_for_each_found_proc for_each_found, short trace_for_tag, GC_print_tagged_value_proc print_tagged_value, int path_length_limit)
GC2_EXTERN void GC_dump_variable_stack (void **var_stack, long delta, void *limit, void *stack_mem, GC_get_type_name_proc get_type_name, GC_get_xtagged_name_proc get_xtagged_name, GC_print_tagged_value_proc print_tagged_value)
GC2_EXTERN int GC_is_tagged (void *p)
GC2_EXTERN int GC_is_tagged_start (void *p)
GC2_EXTERN voidGC_next_tagged_start (void *p)

Define Documentation

#define GC_DUMP_SHOW_DETAILS   0x1

Definition at line 31 of file gc2_dump.h.

#define GC_DUMP_SHOW_FINALS   0x4

Definition at line 33 of file gc2_dump.h.

#define GC_DUMP_SHOW_TRACE   0x2

Definition at line 32 of file gc2_dump.h.


Typedef Documentation

Definition at line 9 of file gc2_dump.h.

typedef char*(* GC_get_type_name_proc)(short t)

Definition at line 7 of file gc2_dump.h.

typedef char*(* GC_get_xtagged_name_proc)(void *p)

Definition at line 8 of file gc2_dump.h.

typedef void(* GC_print_tagged_value_proc)(const char *prefix, void *v, int xtagged, unsigned long diff, int max_w, const char *suffix)

Definition at line 11 of file gc2_dump.h.


Function Documentation

GC2_EXTERN void GC_dump_variable_stack ( void **  var_stack,
long  delta,
void limit,
void stack_mem,
GC_get_type_name_proc  get_type_name,
GC_get_xtagged_name_proc  get_xtagged_name,
GC_print_tagged_value_proc  print_tagged_value 
)

Here is the caller graph for this function:

GC2_EXTERN void GC_dump_with_traces ( int  flags,
GC_get_type_name_proc  get_type_name,
GC_get_xtagged_name_proc  get_xtagged_name,
GC_for_each_found_proc  for_each_found,
short  trace_for_tag,
GC_print_tagged_value_proc  print_tagged_value,
int  path_length_limit 
)

Definition at line 4508 of file compact.c.

{
  int i;
  long waste = 0;

  if (!(flags & GC_DUMP_SHOW_TRACE))
    trace_for_tag = -1;
#if KEEP_BACKPOINTERS
  reset_object_traces();
#endif
  if (for_each_found)
    avoid_collection++;

  if (flags & GC_DUMP_SHOW_DETAILS) {
    GCPRINT(GCOUTF, "t=tagged a=atomic v=array x=xtagged g=tagarray\n");
    GCPRINT(GCOUTF, "mpagesize=%ld  opagesize=%ld\n", (long)MPAGE_SIZE, (long)OPAGE_SIZE);
    GCPRINT(GCOUTF, "[");
    for (i = 0; i < MAPS_SIZE; i++) {
      if (i && !(i & 63))
       GCPRINT(GCOUTF, "\n ");

      if (mpage_maps[i])
       GCPRINT(GCOUTF, "*");
      else
       GCPRINT(GCOUTF, "-");
    }
    GCPRINT(GCOUTF, "]\n");
    for (i = 0; i < MAPS_SIZE; i++) {
      MPage *maps = mpage_maps[i];
      if (maps) {
       int j;
       GCPRINT(GCOUTF, "%.2x:\n ", i);
       for (j = 0; j < MAP_SIZE; j++) {
         if (j && !(j & 63))
           GCPRINT(GCOUTF, "\n ");

         if (maps[j].type
#if DEFINE_MALLOC_FREE
             && (maps[j].type != MTYPE_MALLOCFREE)
#endif
             ) {
           int c;

           if (maps[j].flags & MFLAG_CONTINUED) 
             c = '.';
           else {
             if (maps[j].type <= MTYPE_TAGGED)
              c = 't';
             else if (maps[j].type == MTYPE_TAGGED_ARRAY)
              c = 'g';
             else if (maps[j].type == MTYPE_ATOMIC)
              c = 'a';
             else if (maps[j].type == MTYPE_XTAGGED)
              c = 'x';
             else
              c = 'v';
           
             if (maps[j].flags & MFLAG_BIGBLOCK)
              c = c - ('a' - 'A');
           }

           GCPRINT(GCOUTF, "%c", c);
         } else {
           GCPRINT(GCOUTF, "-");
         }
       }
       GCPRINT(GCOUTF, "\n");
      }
    }

    {
      MPage *page;

      GCPRINT(GCOUTF, "Block info: [type][modified?][age][refs-age]\n");
      for (page = first, i = 0; page; page = page->next, i++) {
       int c;

       if (page->flags & MFLAG_CONTINUED) 
         c = '.';
       else {
         if (page->type <= MTYPE_TAGGED)
           c = 't';
         else if (page->type == MTYPE_TAGGED_ARRAY)
           c = 'g';
         else if (page->type == MTYPE_ATOMIC)
           c = 'a';
         else if (page->type == MTYPE_XTAGGED)
           c = 'x';
         else
           c = 'v';
        
         if (page->flags & MFLAG_BIGBLOCK)
           c = c - ('a' - 'A');
       }
       
       GCPRINT(GCOUTF, " %c%c%c%c",
              c,
              ((page->flags & MFLAG_MODIFIED)
               ? 'M'
               : '_'),
              ((page->age < 10)
               ? (page->age + '0')
               : (page->age + 'a' - 10)),
              ((page->type == MTYPE_ATOMIC)
               ? '-'
               : ((page->refs_age < 10)
                  ? (page->refs_age + '0')
                  : (page->refs_age + 'a' - 10))));
       if ((i % 10) == 9)
         GCPRINT(GCOUTF, "\n");
      }
      GCPRINT(GCOUTF, "\n");
    }
  }

  {
    int j;

    init();
    set_ending_tags();

    for (j = 0; j < NUM_SETS; j++) {
      int kind, i;
      char *name;
      MPage *page;
      long used, total;

      switch (j) {
      case 1: kind = MTYPE_ARRAY; name = "array"; break;
      case 2: kind = MTYPE_ATOMIC; name = "atomic"; break;
      case 3: kind = MTYPE_XTAGGED; name = "xtagged"; break;
      case 4: kind = MTYPE_TAGGED_ARRAY; name = "tagarray"; break;
      default: kind = MTYPE_TAGGED; name = "tagged"; break;
      }

      for (i = 0; i < (BIGBLOCK_MIN_SIZE >> LOG_WORD_SIZE); i++)
       dump_info_array[i] = 0;

      total = 0;

      for (page = first; page; page = page->next) {
       if ((page->type == kind) && !(page->flags & MFLAG_BIGBLOCK)) {
         if (j >= NUM_TAGGED_SETS)
           used = scan_untagged_mpage(page->block_start, page); /* gets size counts */
         else
           used = scan_tagged_mpage(page->block_start, page, 
                                 trace_for_tag, for_each_found); /* gets tag counts */

         total += used;
         waste += (MPAGE_WORDS - used);
       }
       if ((page->flags & MFLAG_BIGBLOCK)
           && (page->type == kind)
           && (((trace_for_tag >= (BIGBLOCK_MIN_SIZE >> LOG_WORD_SIZE))
               && (page->u.size > trace_for_tag))
              || (page->u.size == -trace_for_tag))) {
#if KEEP_BACKPOINTERS
         register_traced_object(page->block_start);
#endif
         if (for_each_found)
           for_each_found(page->block_start);
       }
      }

      if (j >= NUM_TAGGED_SETS) {
       int k = 0;
       if (flags & GC_DUMP_SHOW_DETAILS) {
         GCPRINT(GCOUTF, "%s counts: ", name);
         for (i = 0; i < (BIGBLOCK_MIN_SIZE >> LOG_WORD_SIZE); i++) {
           if (dump_info_array[i]) {
             k++;
             if (k == 10) {
              GCPRINT(GCOUTF, "\n    ");
              k = 0;
             }
             GCPRINT(GCOUTF, " [%d:%ld]", i << LOG_WORD_SIZE, dump_info_array[i]);
           }
         }
         GCPRINT(GCOUTF, "\n");
       }
      } else {
       GCPRINT(GCOUTF, "Tag counts and sizes:\n");
       GCPRINT(GCOUTF, "Begin MzScheme3m\n");
       for (i = 0; i < NUMBER_OF_TAGS; i++) {
         if (dump_info_array[i]) {
           char *tn, buf[256];
           switch(i) {
           case gc_on_free_list_tag: tn = "freelist-elem"; break;
           default:
             if (i == weak_array_tag)
              tn = "weak-array";
             else if (get_type_name)
              tn = get_type_name((Type_Tag)i);
             else
              tn = NULL;
             if (!tn) {
              sprintf(buf, "unknown,%d", i);
              tn = buf;
             }
             break;
           }
           GCPRINT(GCOUTF, "  %20.20s: %10ld %10ld\n", tn, dump_info_array[i], (dump_info_array[i + NUMBER_OF_TAGS]) << LOG_WORD_SIZE);
         }
       }
       GCPRINT(GCOUTF, "End MzScheme3m\n");
      }

      if (flags & GC_DUMP_SHOW_DETAILS) {
       int did_big = 0;
       for (page = first; page; page = page->next) {
         if ((page->type == kind) && (page->flags & MFLAG_BIGBLOCK) && !(page->flags & MFLAG_CONTINUED)) {
           if (!did_big) {
             GCPRINT(GCOUTF, "    ");
             did_big = 1;
           }
           if (j >= NUM_TAGGED_SETS)
             GCPRINT(GCOUTF, " [+%ld]", page->u.size);
           else
             GCPRINT(GCOUTF, " %d:[+%ld]", (int)*(Type_Tag *)(page->block_start), page->u.size);
           
           total += (page->u.size >> LOG_WORD_SIZE);
           waste += ((page->u.size >> LOG_WORD_SIZE)  & (MPAGE_WORDS - 1));
         }
       }
       if (did_big)
         GCPRINT(GCOUTF, "\n");
      }

      GCPRINT(GCOUTF, " Total %s: %ld\n", name, total << LOG_WORD_SIZE);
    }
  }

  GCPRINT(GCOUTF, "Active fnls: %d\n", GC->num_fnls);
  GCPRINT(GCOUTF, "Active fnl weak links: %d\n", fnl_weak_link_count);

  if (memory_in_use > max_memory_use)
    max_memory_use = memory_in_use;
  
  GCPRINT(GCOUTF, "Number of collections: %d  (%d compacting)\n", gc_count, compact_count);
  GCPRINT(GCOUTF, "Memory high point: %ld\n", max_memory_use);

  GCPRINT(GCOUTF, "Memory use: %ld\n", memory_in_use - FREE_LIST_DELTA);
  GCPRINT(GCOUTF, "Memory wasted: %ld (%.2f%%)\n", waste << LOG_WORD_SIZE, 
         (100.0 * (waste << LOG_WORD_SIZE)) / memory_in_use);
  GCPRINT(GCOUTF, "Memory overhead: %ld (%.2f%%)   %ld (%.2f%%) on free list\n", 
         page_allocations - memory_in_use + FREE_LIST_DELTA,
         (100.0 * ((double)page_allocations - memory_in_use)) / memory_in_use,
         (long)FREE_LIST_DELTA,
         (100.0 * FREE_LIST_DELTA) / memory_in_use);
  GCPRINT(GCOUTF, "Mmap overhead: %ld (%.2f%%)\n", 
         vm_memory_allocated(GC->vm) - memory_in_use + FREE_LIST_DELTA,
         (100.0 * ((double) vm_memory_allocated(GC->vm) - memory_in_use)) / memory_in_use);

#if KEEP_BACKPOINTERS
  if (flags & GC_DUMP_SHOW_TRACE) {
    print_traced_objects(path_length_limit, get_type_name, get_xtagged_name, print_tagged_value);
  }
  if (flags & GC_DUMP_SHOW_FINALS) {
    Fnl *f;
    avoid_collection++;
    GCPRINT(GCOUTF, "Begin Finalizations\n");
    for (f = finalizers; f; f = f->next) {
      print_out_pointer("==@ ", f->p, get_type_name, get_xtagged_name, print_tagged_value);
    }
    GCPRINT(GCOUTF, "End Finalizations\n");
    --avoid_collection;
  }
#endif
  if (for_each_found)
    --avoid_collection;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function: