Reduce kthead execution time

This commit is contained in:
Mathieu Maret 2021-10-30 15:34:13 +02:00
parent 5230b971b2
commit ec65623da4
1 changed files with 7 additions and 7 deletions

View File

@ -296,10 +296,10 @@ void sleepThread(void *arg)
while (secSleep < 5) {
// printf("Sleeping loop %d\n", secSleep);
secSleep++;
threadMsleep(1000);
threadMsleep(100);
}
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);
printf("I should never be showed\n");
assert(1);
@ -315,7 +315,7 @@ void mutThread(void *arg)
while (test > 0) {
mutexLock(&mutexTest);
printf("%s sleep\n", (char *)arg);
threadMsleep(1000);
threadMsleep(100);
printf("%s up\n", (char *)arg);
mutexUnlock(&mutexTest);
test--;
@ -327,7 +327,7 @@ void wqThread(void *arg)
(void)arg;
DECLARE_WAITQUEUE(test);
waitQueueInit(&test);
assert(waitTimeout(&test, 1000) == 1);
assert(waitTimeout(&test, 100) == 1);
waitQueueFree(&test);
haveTimeout = 1;
}
@ -338,12 +338,12 @@ void testKthread()
// 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("Test1", (cpu_kstate_function_arg1_t *)kthread1, (void *)"Hlowrd\n");
threadMsleep(1000);
threadMsleep(100);
threadCreate("wq timeout", wqThread, NULL);
threadMsleep(2000);
threadMsleep(200);
assert(haveTimeout);
threadCreate("sleep", sleepThread, NULL);
threadMsleep(5000);
threadMsleep(500);
threadCreate("mtest1", mutThread, "mut1");
threadCreate("mtest2", mutThread, "mut2");
threadCreate("mtest3", mutThread, "mut3");