1: #ifndef lint
   2: static char *rcsid =
   3:    "$Header: lamgc.c,v 1.5 84/03/31 22:34:28 layer Exp $";
   4: #endif
   5: 
   6: /*					-[Sat Jan 29 13:07:37 1983 by jkf]-
   7:  * 	lamgc.c				$Locker:  $
   8:  * file used to meter gc, not always loaded
   9:  *
  10:  * (c) copyright 1982, Regents of the University of California
  11:  */
  12: 
  13: #include "global.h"
  14: #include "gc.h"
  15: #include <sys/types.h>
  16: #ifdef METER
  17: #include <sys/vtimes.h>
  18: #endif
  19: 
  20: /*
  21:   this file  is temporary and will contain routines to meter
  22:   the garbage collector
  23:  */
  24: 
  25: /* gcstat - temporary routine used to report on gc statistics.
  26:    if this causes variables to be undefined,then it should be removed
  27: */
  28: 
  29: extern int *beginsweep,gensymcounter;
  30: int gcstat;
  31: int mrkdpcnt;
  32: int gccount;
  33: int conssame;
  34: int consdiff;
  35: int consnil;
  36: 
  37: 
  38: /*
  39:  *	gcstat  - initiate and record gc statistics
  40:  * calls:
  41:  *  	(gcstat 0) -- initiate gc statistics by creating gc.out
  42:  *		      and writing header.
  43:  *	(gcstat 1) -- finish off gc statistics file by writing typetable
  44:  *		      and closing file.
  45:  */
  46: lispval
  47: Lgcstat()
  48: {
  49:     register lispval handy;
  50:     int nbytes;
  51:     struct gchead hhh;
  52: 
  53:     chkarg(1,"gcstat");
  54: 
  55:     if(TYPE(handy=lbot->val) != INT)
  56:     {   error("gcstat: non integer arg ",FALSE);
  57:     }
  58: 
  59:     switch(handy->i)
  60:     {
  61:         case 0:  if((gcstat = creat("gc.out",0644)) < 0)
  62:                error("cant open gc.out",FALSE);
  63:              hhh.version = 5;
  64:              hhh.lowdata = (int)beginsweep;
  65:              printf("writing %d bytes \n",sizeof(hhh));
  66:              write(gcstat,(char *)&hhh,sizeof(hhh));
  67:              gccount = 0;
  68:              return(tatom);
  69: 
  70:         case 1:
  71:              /* first write out the type table */
  72:              nbytes = 0;
  73:              /* 0 means type table follows */
  74:              printf("gc's %d, writing %d bytes \n",gccount,
  75:                   sizeof(nbytes));
  76:              write(gcstat,(char *)&nbytes,sizeof(nbytes));
  77:              write(gcstat,(char *)&typetable[ATOX(beginsweep)+1],
  78:                 nbytes = ((int)datalim - (int)beginsweep)>>9);
  79:              printf("writing %d bytes \n",nbytes+sizeof(nbytes));
  80:              write(gcstat,(char *)&nbytes,sizeof(nbytes));
  81:              close(gcstat);
  82:              gcstat = 0;
  83:              return(inewint(nbytes));
  84:         default:
  85:              error("Bad value to gcstat ",TRUE);
  86:     }
  87:     /* NOTREACHED */
  88: }
  89: extern int bitmapi[];       /* a bit of a lie it is really a double array*/
  90: char *bitmapc = (char *)bitmapi;
  91: /* called in the garbage collector after the bit maps have been made
  92:    only if gcstat is non zero */
  93: gcdump()
  94: {
  95: #ifdef
  96:     extern struct vtimes premark,presweep,alldone;
  97:     int nbytes, recsize;
  98:     /* 16 bytes/page in the bitmap */
  99:     nbytes = (((int) datalim - (int) beginsweep) >> 9) * 16;
 100:     recsize = nbytes + 6*sizeof(int) + 3*sizeof(struct vtimes);
 101:     write(gcstat,(char *)&recsize,sizeof(recsize)); /* whole record size */
 102:     write(gcstat,(char *)&premark,sizeof(premark));
 103:     write(gcstat,(char *)&presweep,sizeof(presweep));
 104:     write(gcstat,(char *)&alldone,sizeof(alldone));
 105:     write(gcstat,(char *)&gensymcounter,sizeof(int));
 106:     write(gcstat,(char *)&conssame,sizeof(int));
 107:     write(gcstat,(char *)&consdiff,sizeof(int));
 108:     write(gcstat,(char *)&consnil,sizeof(int));
 109:     write(gcstat,(char *)&mrkdpcnt,sizeof(int));
 110:     write(gcstat,(char *)&nbytes,sizeof(nbytes));   /* bit table size */
 111:     write(gcstat,(char *)&bitmapc[ATOX(beginsweep) * 16],nbytes);
 112:     printf("gc: %d, written %d bytes\n",++gccount,nbytes);
 113: #endif
 114: }

Defined functions

Lgcstat defined in line 46; never used
gcdump defined in line 93; used 1 times

Defined variables

bitmapc defined in line 90; used 1 times
consdiff defined in line 34; used 4 times
consnil defined in line 35; used 3 times
conssame defined in line 33; used 4 times
gccount defined in line 32; used 3 times
gcstat defined in line 30; used 21 times
mrkdpcnt defined in line 31; used 3 times
rcsid defined in line 2; never used
Last modified: 1985-08-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 929
Valid CSS Valid XHTML 1.0 Strict