...
 
Commits (2)
......@@ -13,5 +13,7 @@ if DBM:
env.Install(dir=BINDIR, source=makedb)
Default(makedb)
Decider('MD5')
env.Alias("install", BINDIR)
env.Alias("install", MANDIR)
......@@ -29,8 +29,7 @@ extern int tracelink();
extern char *optarg;
extern int optind;
extern long Lcount, Ncount;
extern long allocation();
extern void wasted(), mapit(), hashanalyze(), deadlink();
extern void mapit(), hashanalyze(), deadlink();
extern char *local();
extern node *addnode();
extern int getopt(), yyparse();
......@@ -46,7 +45,6 @@ int MAIN(argc, argv)
int errflg = 0;
setbuf(stderr, (char *) 0);
(void) allocation(); /* initialize data space monitoring */
Cfile = "[deadlinks]"; /* for tracing dead links */
Argv = argv;
Argc = argc;
......@@ -125,21 +123,17 @@ int MAIN(argc, argv)
if (Vflag > 1)
hashanalyze();
vprintf(stderr, "%ld nodes, %ld links, alloc %ldk\n",
Ncount, Lcount, allocation());
vprintf(stderr, "%ld nodes, %ld links\n",
Ncount, Lcount );
Cfile = "[backlinks]"; /* for tracing back links */
Lineno = 0;
/* compute shortest path tree */
mapit();
vprintf(stderr, "allocation is %ldk after mapping\n", allocation());
/* traverse tree and print paths */
printit();
vprintf(stderr, "allocation is %ldk after printing\n", allocation());
wasted(); /* how much was wasted in memory allocation? */
return OK;
}
......
......@@ -27,7 +27,7 @@ extern char *Linkout, *Graphout;
extern void freelink(), resetnodes(), printit(), dumpgraph();
extern void showlinks(), die();
extern long pack(), allocation();
extern long pack();
extern link *newlink(), *addlink();
extern int maptrace(), tiebreaker();
extern node *ncopy();
......@@ -84,7 +84,7 @@ mapit()
n->n_flag |= MAPPED;
heapchildren(n); /* add children to heap */
}
vprintf(stderr, "heap hiwat %ld\nalloc %ldk, ncopy = %ld, nlink = %ld, lcopy = %ld\n", Heaphighwater, allocation(), NumNcopy, Nlink, NumLcopy);
vprintf(stderr, "heap hiwat %ld\n, ncopy = %ld, nlink = %ld, lcopy = %ld\n", Heaphighwater, NumNcopy, Nlink, NumLcopy);
if (Nheap != 0) /* sanity check */
die("null entry in heap");
......
/* pathalias -- by steve bellovin, as told to peter honeyman */
#ifndef lint
static char *sccsid = "@(#)mem.c 9.6 92/08/25";
#endif
......@@ -7,21 +6,16 @@ static char *sccsid = "@(#)mem.c 9.6 92/08/25";
/* exports */
long Ncount;
extern void freelink(), wasted(), freetable();
extern long allocation();
extern void freelink(), freetable();
/* imports */
extern char *Netchars;
extern int Vflag;
extern void die();
#ifdef DEBUG
extern char *sbrk();
#endif
/* privates */
STATIC void nomem();
static link *Lcache;
static unsigned long Memwaste;
link *
newlink()
......@@ -109,42 +103,5 @@ freetable(t, size)
STATIC void
nomem()
{
#ifdef DEBUG
static char epitaph[128];
sprintf(epitaph, "out of memory (%ldk allocated)", allocation());
die(epitaph);
#else
die("out of memory");
#endif
}
/* data space allocation -- main sets `dataspace' very early */
long
allocation()
{
#ifdef DEBUG
static char *dataspace;
long rval;
if (dataspace == 0) { /* first time */
dataspace = sbrk(0);
return 0;
}
rval = (sbrk(0) - dataspace)/1024;
if (rval < 0) /* funny architecture? */
rval = -rval;
return rval;
#else
return 0;
#endif
}
/* how much memory has been wasted? */
void
wasted()
{
if (Memwaste == 0)
return;
vprintf(stderr, "memory allocator wasted %ld bytes\n", Memwaste);
}