Skip to content

Commit

Permalink
Merge branch 'master' of gitlab.ops-class.org:staff/os161
Browse files Browse the repository at this point in the history
  • Loading branch information
gurupras committed Mar 10, 2016
2 parents c9c9e50 + d322a01 commit 03f484f
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 15 deletions.
1 change: 1 addition & 0 deletions kern/include/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ void *kmalloc(size_t size);
void kfree(void *ptr);
void kheap_printstats(void);
void kheap_printused(void);
unsigned long kheap_getused(void);
void kheap_nextgeneration(void);
void kheap_dump(void);
void kheap_dumpall(void);
Expand Down
25 changes: 18 additions & 7 deletions kern/vm/kmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,25 +819,36 @@ kheap_printstats(void)
spinlock_release(&kmalloc_spinlock);
}


/*
* Print number of used heap bytes.
* Return the number of used bytes.
*/
void
kheap_printused(void)
{

unsigned long
kheap_getused(void) {
struct pageref *pr;
unsigned long total = 0;
char total_string[32];

/* print the whole thing with interrupts off */
/* compute with interrupts off */
spinlock_acquire(&kmalloc_spinlock);
for (pr = allbase; pr != NULL; pr = pr->next_all) {
total += subpage_stats(pr, true);
}
total += coremap_used_bytes();
spinlock_release(&kmalloc_spinlock);

snprintf(total_string, sizeof(total_string), "%lu", total);
return total;
}

/*
* Print number of used bytes.
*/

void
kheap_printused(void)
{
char total_string[32];
snprintf(total_string, sizeof(total_string), "%lu", kheap_getused());
secprintf(SECRET, total_string, "khu");
}

Expand Down
4 changes: 3 additions & 1 deletion test161/tests/synch/cvt1.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
name: "CV Test 1"
description:
Tests core CV functionality through cyclic waiting.
tags: [synch, cvs]
tags: [synch, cvs, kleaks]
depends: [boot, semaphores, locks]
sys161:
cpus: 32
---
khu
cvt1
khu
4 changes: 3 additions & 1 deletion test161/tests/synch/cvt2.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ name: "CV Test 2"
description:
Tests core CV functionality through a mixture of sleeping and waking
threads.
tags: [synch, cvs]
tags: [synch, cvs, kleaks]
depends: [boot, semaphores, locks]
sys161:
cpus: 32
---
khu
cvt2
khu
6 changes: 4 additions & 2 deletions test161/tests/synch/cvt5.t
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
name: "CV Test 5"
description:
Tests CV and location relationship.
tags: [synch, cvs]
Tests CV and lock relationship.
tags: [synch, cvs, kleaks]
depends: [boot, locks]
sys161:
cpus: 32
---
khu
cvt5
khu
4 changes: 3 additions & 1 deletion test161/tests/synch/lt1.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
name: "Lock Test 1"
description:
Tests core lock functionality through modifications to shared state.
tags: [synch, locks]
tags: [synch, locks, kleaks]
depends: [boot, semaphores]
sys161:
cpus: 32
---
khu
lt1
khu
4 changes: 3 additions & 1 deletion test161/tests/synch/rwt1.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ name: "RW Lock Test 1"
description:
Tests core reader-writer lock functionality by reading and writing shared
state.
tags: [synch, rwlocks]
tags: [synch, rwlocks, kleaks]
depends: [boot, semaphores]
sys161:
cpus: 32
---
khu
rwt1
khu
4 changes: 3 additions & 1 deletion test161/tests/synch/rwt2.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ name: "RW Lock Test 2"
description:
Tests that reader-writer locks allow maximum read concurrency when no
writers are waiting.
tags: [synch, rwlocks]
tags: [synch, rwlocks, kleaks]
depends: [boot, semaphores, cvs]
sys161:
cpus: 32
---
khu
rwt2
khu
4 changes: 3 additions & 1 deletion test161/tests/synch/sem1.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
name: "Semaphore Test"
description:
Tests core semaphore logic through cycling signaling.
tags: [synch, semaphores]
tags: [synch, semaphores, kleaks]
depends: [boot]
sys161:
cpus: 32
---
khu
sem1
khu
2 changes: 2 additions & 0 deletions test161/tests/synchprobs/sp1.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ name: "Whalemating Test"
tags: [synchprobs]
depends: [boot, semaphores, locks]
---
khu
sp1
khu
2 changes: 2 additions & 0 deletions test161/tests/synchprobs/sp2.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ name: "Stoplight Test"
tags: [synchprobs]
depends: [boot, semaphores, locks, cvs]
---
khu
sp2
khu

0 comments on commit 03f484f

Please sign in to comment.