forked from xuos/xiuos
test full 100 threads on XiZi, test is ok
This commit is contained in:
parent
3bec8f496a
commit
55c8de20d9
|
@ -13,7 +13,7 @@
|
||||||
/**
|
/**
|
||||||
* @file test_threadsched.c
|
* @file test_threadsched.c
|
||||||
* @brief support to test thread sched function
|
* @brief support to test thread sched function
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author AIIT XUOS Lab
|
* @author AIIT XUOS Lab
|
||||||
* @date 2021-04-24
|
* @date 2021-04-24
|
||||||
*/
|
*/
|
||||||
|
@ -25,11 +25,14 @@
|
||||||
extern long ShowTask(void);
|
extern long ShowTask(void);
|
||||||
extern unsigned int msleep(uint64_t msec);
|
extern unsigned int msleep(uint64_t msec);
|
||||||
|
|
||||||
|
#define BATCH_TEST_TASK_SIZE 100
|
||||||
|
|
||||||
static int32 tid1 = NONE;
|
static int32 tid1 = NONE;
|
||||||
static int32 tid2 = NONE;
|
static int32 tid2 = NONE;
|
||||||
static int32 tid3 = NONE;
|
static int32 tid3 = NONE;
|
||||||
static int32 tid4 = NONE;
|
static int32 tid4 = NONE;
|
||||||
static int32 tid5 = NONE;
|
static int32 tid5 = NONE;
|
||||||
|
static int32 tids[BATCH_TEST_TASK_SIZE];
|
||||||
|
|
||||||
#define DYNAMIC_TASK_STACK_SIZE 3072
|
#define DYNAMIC_TASK_STACK_SIZE 3072
|
||||||
#define PRIORITY 15
|
#define PRIORITY 15
|
||||||
|
@ -56,12 +59,12 @@ static void Task1Entry(void *parameter)
|
||||||
ShowTask();
|
ShowTask();
|
||||||
#endif
|
#endif
|
||||||
KPrintf("\n");
|
KPrintf("\n");
|
||||||
|
|
||||||
DOUBLE_LINKLIST_FOR_EACH(node, head) {
|
DOUBLE_LINKLIST_FOR_EACH(node, head) {
|
||||||
tmp = SYS_DOUBLE_LINKLIST_ENTRY(node, struct TaskDyncSchedMember, sched_link);
|
tmp = SYS_DOUBLE_LINKLIST_ENTRY(node, struct TaskDyncSchedMember, sched_link);
|
||||||
obj =CONTAINER_OF(tmp,struct TaskDescriptor, task_dync_sched_member);
|
obj =CONTAINER_OF(tmp,struct TaskDescriptor, task_dync_sched_member);
|
||||||
KPrintf("task ready table node name = %s node remaining_tick= %d node advance_cnt =%d\n",obj->task_base_info.name,
|
KPrintf("task ready table node name = %s node remaining_tick= %d node advance_cnt =%d\n",obj->task_base_info.name,
|
||||||
obj->task_dync_sched_member.rest_timeslice, obj->task_dync_sched_member.advance_cnt);
|
obj->task_dync_sched_member.rest_timeslice, obj->task_dync_sched_member.advance_cnt);
|
||||||
}
|
}
|
||||||
#ifdef ARCH_SMP
|
#ifdef ARCH_SMP
|
||||||
#ifdef SCHED_POLICY_FIFO
|
#ifdef SCHED_POLICY_FIFO
|
||||||
|
@ -120,15 +123,8 @@ void DynamicTaskSchedTest(char* parm)
|
||||||
if (0 == strncmp("-b", parm, strlen("-b")) || 0 == strncmp("-bind", parm, strlen("-bind"))){
|
if (0 == strncmp("-b", parm, strlen("-b")) || 0 == strncmp("-bind", parm, strlen("-bind"))){
|
||||||
strncpy(t_parm,"-b", 4);
|
strncpy(t_parm,"-b", 4);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
tid1 = KTaskCreate("d_tid1",
|
|
||||||
Task1Entry,
|
|
||||||
t_parm,
|
|
||||||
DYNAMIC_TASK_STACK_SIZE,
|
|
||||||
16);
|
|
||||||
if (tid1 >= 0)
|
|
||||||
StartupKTask(tid1);
|
|
||||||
|
|
||||||
tid2 = KTaskCreate("d_tid2",
|
tid2 = KTaskCreate("d_tid2",
|
||||||
Task2Entry,
|
Task2Entry,
|
||||||
"d_tid2",
|
"d_tid2",
|
||||||
|
@ -141,7 +137,7 @@ void DynamicTaskSchedTest(char* parm)
|
||||||
#endif
|
#endif
|
||||||
if (tid2 >= 0)
|
if (tid2 >= 0)
|
||||||
StartupKTask(tid2);
|
StartupKTask(tid2);
|
||||||
|
|
||||||
tid3 = KTaskCreate("d_tid3",
|
tid3 = KTaskCreate("d_tid3",
|
||||||
Task3Entry,
|
Task3Entry,
|
||||||
"d_tid3",
|
"d_tid3",
|
||||||
|
@ -154,7 +150,7 @@ void DynamicTaskSchedTest(char* parm)
|
||||||
#endif
|
#endif
|
||||||
if (tid3 >= 0)
|
if (tid3 >= 0)
|
||||||
StartupKTask(tid3);
|
StartupKTask(tid3);
|
||||||
|
|
||||||
tid4 = KTaskCreate("d_tid4",
|
tid4 = KTaskCreate("d_tid4",
|
||||||
Task4Entry,
|
Task4Entry,
|
||||||
"d_tid4",
|
"d_tid4",
|
||||||
|
@ -167,7 +163,7 @@ void DynamicTaskSchedTest(char* parm)
|
||||||
#endif
|
#endif
|
||||||
if (tid4 >= 0)
|
if (tid4 >= 0)
|
||||||
StartupKTask(tid4);
|
StartupKTask(tid4);
|
||||||
|
|
||||||
tid5 = KTaskCreate("d_tid5",
|
tid5 = KTaskCreate("d_tid5",
|
||||||
Task5Entry,
|
Task5Entry,
|
||||||
"d_tid5",
|
"d_tid5",
|
||||||
|
@ -183,8 +179,24 @@ void DynamicTaskSchedTest(char* parm)
|
||||||
StartupKTask(tid5);
|
StartupKTask(tid5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void BatchTaskSchedTest(char* parm)
|
||||||
|
{
|
||||||
|
memset(tids, 0, sizeof(int32) * BATCH_TEST_TASK_SIZE);
|
||||||
|
char task_name[20] = "batch_tid_";
|
||||||
|
for(int i = 0; i < BATCH_TEST_TASK_SIZE;i++){
|
||||||
|
task_name[9] = (char)(i / 100 + '0');
|
||||||
|
task_name[10] = (char)((i / 10) % 10 + '0');
|
||||||
|
task_name[11] = (char)(i % 10 + '0');
|
||||||
|
task_name[12] = 0;
|
||||||
|
tids[i] = KTaskCreate(task_name, Task2Entry, task_name, 128, 15);
|
||||||
|
if(tids[i] >= 0){
|
||||||
|
StartupKTask(tids[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
static void UsageHelp(void)
|
static void UsageHelp(void)
|
||||||
{
|
{
|
||||||
KPrintf("test_task_ready_usage.\n");
|
KPrintf("test_task_ready_usage.\n");
|
||||||
}
|
}
|
||||||
|
@ -192,8 +204,7 @@ static void UsageHelp(void)
|
||||||
int TestTaskReadyAndSched(int argc, char * argv[])
|
int TestTaskReadyAndSched(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
DynamicTaskSchedTest(argv[0]);
|
DynamicTaskSchedTest(argv[0]);
|
||||||
|
BatchTaskSchedTest(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue