Merge branch 'master' of gitlab.ops-class.org:staff/os161

This commit is contained in:
Guru Prasad Srinivasa 2016-03-10 17:30:37 -05:00
commit 03f484ff21
11 changed files with 45 additions and 15 deletions

View File

@ -130,6 +130,7 @@ void *kmalloc(size_t size);
void kfree(void *ptr); void kfree(void *ptr);
void kheap_printstats(void); void kheap_printstats(void);
void kheap_printused(void); void kheap_printused(void);
unsigned long kheap_getused(void);
void kheap_nextgeneration(void); void kheap_nextgeneration(void);
void kheap_dump(void); void kheap_dump(void);
void kheap_dumpall(void); void kheap_dumpall(void);

View File

@ -819,17 +819,17 @@ kheap_printstats(void)
spinlock_release(&kmalloc_spinlock); 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; struct pageref *pr;
unsigned long total = 0; unsigned long total = 0;
char total_string[32];
/* print the whole thing with interrupts off */ /* compute with interrupts off */
spinlock_acquire(&kmalloc_spinlock); spinlock_acquire(&kmalloc_spinlock);
for (pr = allbase; pr != NULL; pr = pr->next_all) { for (pr = allbase; pr != NULL; pr = pr->next_all) {
total += subpage_stats(pr, true); total += subpage_stats(pr, true);
@ -837,7 +837,18 @@ kheap_printused(void)
total += coremap_used_bytes(); total += coremap_used_bytes();
spinlock_release(&kmalloc_spinlock); 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"); secprintf(SECRET, total_string, "khu");
} }

View File

@ -2,9 +2,11 @@
name: "CV Test 1" name: "CV Test 1"
description: description:
Tests core CV functionality through cyclic waiting. Tests core CV functionality through cyclic waiting.
tags: [synch, cvs] tags: [synch, cvs, kleaks]
depends: [boot, semaphores, locks] depends: [boot, semaphores, locks]
sys161: sys161:
cpus: 32 cpus: 32
--- ---
khu
cvt1 cvt1
khu

View File

@ -3,9 +3,11 @@ name: "CV Test 2"
description: description:
Tests core CV functionality through a mixture of sleeping and waking Tests core CV functionality through a mixture of sleeping and waking
threads. threads.
tags: [synch, cvs] tags: [synch, cvs, kleaks]
depends: [boot, semaphores, locks] depends: [boot, semaphores, locks]
sys161: sys161:
cpus: 32 cpus: 32
--- ---
khu
cvt2 cvt2
khu

View File

@ -1,10 +1,12 @@
--- ---
name: "CV Test 5" name: "CV Test 5"
description: description:
Tests CV and location relationship. Tests CV and lock relationship.
tags: [synch, cvs] tags: [synch, cvs, kleaks]
depends: [boot, locks] depends: [boot, locks]
sys161: sys161:
cpus: 32 cpus: 32
--- ---
khu
cvt5 cvt5
khu

View File

@ -2,9 +2,11 @@
name: "Lock Test 1" name: "Lock Test 1"
description: description:
Tests core lock functionality through modifications to shared state. Tests core lock functionality through modifications to shared state.
tags: [synch, locks] tags: [synch, locks, kleaks]
depends: [boot, semaphores] depends: [boot, semaphores]
sys161: sys161:
cpus: 32 cpus: 32
--- ---
khu
lt1 lt1
khu

View File

@ -3,9 +3,11 @@ name: "RW Lock Test 1"
description: description:
Tests core reader-writer lock functionality by reading and writing shared Tests core reader-writer lock functionality by reading and writing shared
state. state.
tags: [synch, rwlocks] tags: [synch, rwlocks, kleaks]
depends: [boot, semaphores] depends: [boot, semaphores]
sys161: sys161:
cpus: 32 cpus: 32
--- ---
khu
rwt1 rwt1
khu

View File

@ -3,9 +3,11 @@ name: "RW Lock Test 2"
description: description:
Tests that reader-writer locks allow maximum read concurrency when no Tests that reader-writer locks allow maximum read concurrency when no
writers are waiting. writers are waiting.
tags: [synch, rwlocks] tags: [synch, rwlocks, kleaks]
depends: [boot, semaphores, cvs] depends: [boot, semaphores, cvs]
sys161: sys161:
cpus: 32 cpus: 32
--- ---
khu
rwt2 rwt2
khu

View File

@ -2,9 +2,11 @@
name: "Semaphore Test" name: "Semaphore Test"
description: description:
Tests core semaphore logic through cycling signaling. Tests core semaphore logic through cycling signaling.
tags: [synch, semaphores] tags: [synch, semaphores, kleaks]
depends: [boot] depends: [boot]
sys161: sys161:
cpus: 32 cpus: 32
--- ---
khu
sem1 sem1
khu

View File

@ -3,4 +3,6 @@ name: "Whalemating Test"
tags: [synchprobs] tags: [synchprobs]
depends: [boot, semaphores, locks] depends: [boot, semaphores, locks]
--- ---
khu
sp1 sp1
khu

View File

@ -3,4 +3,6 @@ name: "Stoplight Test"
tags: [synchprobs] tags: [synchprobs]
depends: [boot, semaphores, locks, cvs] depends: [boot, semaphores, locks, cvs]
--- ---
khu
sp2 sp2
khu