Reduce kthead execution time
This commit is contained in:
parent
5230b971b2
commit
ec65623da4
14
tests/test.c
14
tests/test.c
@ -296,10 +296,10 @@ void sleepThread(void *arg)
|
|||||||
while (secSleep < 5) {
|
while (secSleep < 5) {
|
||||||
// printf("Sleeping loop %d\n", secSleep);
|
// printf("Sleeping loop %d\n", secSleep);
|
||||||
secSleep++;
|
secSleep++;
|
||||||
threadMsleep(1000);
|
threadMsleep(100);
|
||||||
}
|
}
|
||||||
unsigned long ellapsedTime = jiffies_to_msecs(jiffies - initialJiffies);
|
unsigned long ellapsedTime = jiffies_to_msecs(jiffies - initialJiffies);
|
||||||
assertmsg(ellapsedTime >= 5000 && ellapsedTime < 5100, "ellapsedTime %d\n", ellapsedTime);
|
assertmsg(ellapsedTime >= 500 && ellapsedTime < 510, "ellapsedTime %d\n", ellapsedTime);
|
||||||
threadMsleep(0);
|
threadMsleep(0);
|
||||||
printf("I should never be showed\n");
|
printf("I should never be showed\n");
|
||||||
assert(1);
|
assert(1);
|
||||||
@ -315,7 +315,7 @@ void mutThread(void *arg)
|
|||||||
while (test > 0) {
|
while (test > 0) {
|
||||||
mutexLock(&mutexTest);
|
mutexLock(&mutexTest);
|
||||||
printf("%s sleep\n", (char *)arg);
|
printf("%s sleep\n", (char *)arg);
|
||||||
threadMsleep(1000);
|
threadMsleep(100);
|
||||||
printf("%s up\n", (char *)arg);
|
printf("%s up\n", (char *)arg);
|
||||||
mutexUnlock(&mutexTest);
|
mutexUnlock(&mutexTest);
|
||||||
test--;
|
test--;
|
||||||
@ -327,7 +327,7 @@ void wqThread(void *arg)
|
|||||||
(void)arg;
|
(void)arg;
|
||||||
DECLARE_WAITQUEUE(test);
|
DECLARE_WAITQUEUE(test);
|
||||||
waitQueueInit(&test);
|
waitQueueInit(&test);
|
||||||
assert(waitTimeout(&test, 1000) == 1);
|
assert(waitTimeout(&test, 100) == 1);
|
||||||
waitQueueFree(&test);
|
waitQueueFree(&test);
|
||||||
haveTimeout = 1;
|
haveTimeout = 1;
|
||||||
}
|
}
|
||||||
@ -338,12 +338,12 @@ void testKthread()
|
|||||||
// It is not expected to have necessarily "Hello world\n" properly written
|
// It is not expected to have necessarily "Hello world\n" properly written
|
||||||
threadCreate("Test2", (cpu_kstate_function_arg1_t *)kthread2, (void *)"el ol\n");
|
threadCreate("Test2", (cpu_kstate_function_arg1_t *)kthread2, (void *)"el ol\n");
|
||||||
threadCreate("Test1", (cpu_kstate_function_arg1_t *)kthread1, (void *)"Hlowrd\n");
|
threadCreate("Test1", (cpu_kstate_function_arg1_t *)kthread1, (void *)"Hlowrd\n");
|
||||||
threadMsleep(1000);
|
threadMsleep(100);
|
||||||
threadCreate("wq timeout", wqThread, NULL);
|
threadCreate("wq timeout", wqThread, NULL);
|
||||||
threadMsleep(2000);
|
threadMsleep(200);
|
||||||
assert(haveTimeout);
|
assert(haveTimeout);
|
||||||
threadCreate("sleep", sleepThread, NULL);
|
threadCreate("sleep", sleepThread, NULL);
|
||||||
threadMsleep(5000);
|
threadMsleep(500);
|
||||||
threadCreate("mtest1", mutThread, "mut1");
|
threadCreate("mtest1", mutThread, "mut1");
|
||||||
threadCreate("mtest2", mutThread, "mut2");
|
threadCreate("mtest2", mutThread, "mut2");
|
||||||
threadCreate("mtest3", mutThread, "mut3");
|
threadCreate("mtest3", mutThread, "mut3");
|
||||||
|
Loading…
Reference in New Issue
Block a user