Merge pull request #7 from eternalNight/master

Fix priority test and lab8 makefile along with some minor maintenances
This commit is contained in:
chyyuu 2015-03-25 08:38:59 +08:00
commit 701c7b9a9f
39 changed files with 51 additions and 17 deletions

2
.dir-locals.el Normal file
View File

@ -0,0 +1,2 @@
((c-mode . ((indent-tabs-mode . nil)
(c-basic-offset . 4))))

2
.gitignore vendored
View File

@ -18,3 +18,5 @@ a.out
*.log *.log
*.exe *.exe
chytesting chytesting
disk0
*.orig

View File

View File

View File

View File

View File

View File

@ -294,6 +294,9 @@ MAKEOPTS := --quiet --no-print-directory
run-%: build-% run-%: build-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size"

View File

View File

@ -294,6 +294,9 @@ MAKEOPTS := --quiet --no-print-directory
run-%: build-% run-%: build-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size"

View File

@ -5,7 +5,7 @@
#include <list.h> #include <list.h>
#include <skew_heap.h> #include <skew_heap.h>
#define MAX_TIME_SLICE 20 #define MAX_TIME_SLICE 5
struct proc_struct; struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5 #define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000 #define MAX_TIME 1000
unsigned int acc[TOTAL]; unsigned int acc[TOTAL];
int status[TOTAL]; int status[TOTAL];
int pids[TOTAL]; int pids[TOTAL];

View File

View File

@ -294,6 +294,9 @@ MAKEOPTS := --quiet --no-print-directory
run-%: build-% run-%: build-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size"

View File

@ -49,7 +49,7 @@ sched_init(void) {
sched_class = &default_sched_class; sched_class = &default_sched_class;
rq = &__rq; rq = &__rq;
rq->max_time_slice = 20; rq->max_time_slice = 5;
sched_class->init(rq); sched_class->init(rq);
cprintf("sched class: %s\n", sched_class->name); cprintf("sched class: %s\n", sched_class->name);

View File

@ -5,7 +5,7 @@
#include <list.h> #include <list.h>
#include <skew_heap.h> #include <skew_heap.h>
#define MAX_TIME_SLICE 20 #define MAX_TIME_SLICE 5
struct proc_struct; struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5 #define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000 #define MAX_TIME 1000
#define SLEEP_TIME 400 #define SLEEP_TIME 400
unsigned int acc[TOTAL]; unsigned int acc[TOTAL];
int status[TOTAL]; int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay(); spin_delay();
++ acc[i]; ++ acc[i];
if(acc[i]%4000==0) { if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) { if((time=gettime_msec())>MAX_TIME+SLEEP_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]); exit(acc[i]);
} }

View File

View File

@ -273,6 +273,9 @@ $(foreach p,$(USER_BINS),$(eval $(call fscopy,$(p),$(SFSROOT)$(SLASH))))
$(SFSROOT): $(SFSROOT):
if [ ! -d "$(SFSROOT)" ]; then mkdir $(SFSROOT); fi if [ ! -d "$(SFSROOT)" ]; then mkdir $(SFSROOT); fi
$(SFSROOT):
$(V)$(MKDIR) $@
$(SFSIMG): $(SFSROOT) $(SFSBINS) | $(call totarget,mksfs) $(SFSIMG): $(SFSROOT) $(SFSBINS) | $(call totarget,mksfs)
$(V)dd if=/dev/zero of=$@ bs=1M count=128 $(V)dd if=/dev/zero of=$@ bs=1M count=128
@$(call totarget,mksfs) $@ $(SFSROOT) @$(call totarget,mksfs) $@ $(SFSROOT)
@ -340,6 +343,9 @@ run-%: build-%
sh-%: script-% sh-%: script-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$*" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$*"

View File

@ -5,7 +5,7 @@
#include <list.h> #include <list.h>
#include <skew_heap.h> #include <skew_heap.h>
#define MAX_TIME_SLICE 20 #define MAX_TIME_SLICE 5
struct proc_struct; struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5 #define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000 #define MAX_TIME 1000
#define SLEEP_TIME 400 #define SLEEP_TIME 400
unsigned int acc[TOTAL]; unsigned int acc[TOTAL];
int status[TOTAL]; int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay(); spin_delay();
++ acc[i]; ++ acc[i];
if(acc[i]%4000==0) { if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) { if((time=gettime_msec())>SLEEP_TIME+MAX_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]); exit(acc[i]);
} }

View File

View File

View File

View File

View File

View File

@ -285,6 +285,9 @@ MAKEOPTS := --quiet --no-print-directory
run-%: build-% run-%: build-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size"

View File

View File

@ -285,6 +285,9 @@ MAKEOPTS := --quiet --no-print-directory
run-%: build-% run-%: build-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size"

View File

@ -5,7 +5,7 @@
#include <list.h> #include <list.h>
#include <skew_heap.h> #include <skew_heap.h>
#define MAX_TIME_SLICE 20 #define MAX_TIME_SLICE 5
struct proc_struct; struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5 #define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000 #define MAX_TIME 1000
unsigned int acc[TOTAL]; unsigned int acc[TOTAL];
int status[TOTAL]; int status[TOTAL];
int pids[TOTAL]; int pids[TOTAL];

View File

View File

@ -285,6 +285,9 @@ MAKEOPTS := --quiet --no-print-directory
run-%: build-% run-%: build-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size"

View File

@ -48,7 +48,7 @@ sched_init(void) {
sched_class = &default_sched_class; sched_class = &default_sched_class;
rq = &__rq; rq = &__rq;
rq->max_time_slice = 20; rq->max_time_slice = 5;
sched_class->init(rq); sched_class->init(rq);
cprintf("sched class: %s\n", sched_class->name); cprintf("sched class: %s\n", sched_class->name);

View File

@ -5,7 +5,7 @@
#define TOTAL 5 #define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000 #define MAX_TIME 1000
#define SLEEP_TIME 400 #define SLEEP_TIME 400
unsigned int acc[TOTAL]; unsigned int acc[TOTAL];
int status[TOTAL]; int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay(); spin_delay();
++ acc[i]; ++ acc[i];
if(acc[i]%4000==0) { if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) { if((time=gettime_msec())>MAX_TIME+SLEEP_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]); exit(acc[i]);
} }

View File

View File

@ -261,6 +261,9 @@ endef
$(foreach p,$(USER_BINS),$(eval $(call fscopy,$(p),$(SFSROOT)$(SLASH)))) $(foreach p,$(USER_BINS),$(eval $(call fscopy,$(p),$(SFSROOT)$(SLASH))))
$(SFSROOT):
$(V)$(MKDIR) $@
$(SFSIMG): $(SFSROOT) $(SFSBINS) | $(call totarget,mksfs) $(SFSIMG): $(SFSROOT) $(SFSBINS) | $(call totarget,mksfs)
$(V)dd if=/dev/zero of=$@ bs=1M count=128 $(V)dd if=/dev/zero of=$@ bs=1M count=128
@$(call totarget,mksfs) $@ $(SFSROOT) @$(call totarget,mksfs) $@ $(SFSROOT)
@ -332,6 +335,9 @@ run-%: build-%
sh-%: script-% sh-%: script-%
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
run-nox-%: build-%
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
build-%: touch build-%: touch
$(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$*" $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$*"

View File

@ -48,7 +48,7 @@ sched_init(void) {
sched_class = &default_sched_class; sched_class = &default_sched_class;
rq = &__rq; rq = &__rq;
rq->max_time_slice = 20; rq->max_time_slice = 5;
sched_class->init(rq); sched_class->init(rq);
cprintf("sched class: %s\n", sched_class->name); cprintf("sched class: %s\n", sched_class->name);

View File

@ -5,7 +5,7 @@
#define TOTAL 5 #define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000 #define MAX_TIME 1000
#define SLEEP_TIME 400 #define SLEEP_TIME 400
unsigned int acc[TOTAL]; unsigned int acc[TOTAL];
int status[TOTAL]; int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay(); spin_delay();
++ acc[i]; ++ acc[i];
if(acc[i]%4000==0) { if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) { if((time=gettime_msec())>SLEEP_TIME+MAX_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]); exit(acc[i]);
} }