|
|
1.1 root 1: /* mdump.c - mdump */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <proc.h>
6: #include <mem.h>
7:
8: /*------------------------------------------------------------------------
9: * mdump -- dump free memory list
10: *------------------------------------------------------------------------
11: */
12: mdump()
13: {
14: PStype ps;
15: int i;
16: struct mblock *mptr;
17: unsigned free;
18: unsigned avail;
19: unsigned stkmem;
20:
21: disable(ps);
22:
23: /* calculate current size of free memory and stack memory */
24:
25: for( free=0,mptr=memlist.mnext ; mptr!=(struct mblock*)NULL ;
26: mptr=mptr->mnext)
27: free += mptr->mlen;
28: for (stkmem=0,i=0 ; i<NPROC ; i++) {
29: if (proctab[i].pstate != PRFREE)
30: stkmem += (unsigned)proctab[i].pstklen;
31: }
32: kprintf("Memory: %u bytes real memory, %u text, %u data, %u bss\n",
33: (unsigned)(sizeof(int)) + (unsigned)maxaddr, (unsigned) &etext,
34: (unsigned) &edata - (unsigned) &etext,
35: (unsigned) &end - (unsigned) &edata);
36: avail = (unsigned)maxaddr - (unsigned) &end + (unsigned)(sizeof(int));
37: kprintf(" initially: %5u avail\n", avail);
38: kprintf(" presently: %5u avail, %5u stack, %5u heap\n",
39: free, stkmem, avail - stkmem - free);
40: kprintf(" free list:\n");
41: for( mptr=memlist.mnext ; mptr!=(struct mblock *)NULL ;
42: mptr=mptr->mnext)
43: kprintf(" block at %6o, length %5u (0%o)\n",
44: mptr, mptr->mlen, mptr->mlen);
45: restore(ps);
46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.