From f355459acc1889c1a5ee3d46a45b7de5b561ca7a Mon Sep 17 00:00:00 2001 From: NicJA Date: Thu, 30 Apr 2015 00:35:35 +0000 Subject: [PATCH] use struct timeval to obtain the cputime. disable display atm until the code is corrected. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@50507 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/c/TaskList.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/workbench/c/TaskList.c b/workbench/c/TaskList.c index 001a7844da..c40501e97e 100644 --- a/workbench/c/TaskList.c +++ b/workbench/c/TaskList.c @@ -70,7 +70,7 @@ struct task IPTR stacksize; IPTR stackused; WORD pri; - UQUAD cputime; + struct timeval cputime; }; static int addtask(struct Task *task, struct task **t, STRPTR *e) @@ -78,13 +78,12 @@ static int addtask(struct Task *task, struct task **t, STRPTR *e) STRPTR s1,s2; struct TagItem QueryTaskTags[] = { - {TaskTag_CPUTime , 0 }, - {TAG_DONE , 0 } + {TaskTag_CPUTime , &(*t)->cputime }, + {TAG_DONE , 0 } }; QueryTaskTagList(task, QueryTaskTags); - (*t)->cputime = QueryTaskTags[0].ti_Data; (*t)->address=task; (*t)->type=task->tc_Node.ln_Type; (*t)->pri =(WORD)task->tc_Node.ln_Pri; @@ -193,6 +192,7 @@ int main(void) FPuts(Output(),"Address\t\tType\tPri\tState\tCPU Time\tStack\tUsed\tName\n"); for(tasks2=buffer;tasks2cputime / eclock; else /* Otherwise we cannot calculate the cpu time :/ */ time = 0; +#endif IPTR args[10]; args[0]=(IPTR)tasks2->address; @@ -208,11 +209,14 @@ int main(void) args[2]=tasks2->pri; args[3]=(IPTR)(tasks2->state==TS_RUN?"running": tasks2->state==TS_READY?"ready":"waiting"); + +#if (0) args[6]=time % 60; time /= 60; args[5]=time % 60; time /= 60; args[4]=time; +#endif args[7]=tasks2->stacksize; args[8]=tasks2->stackused; args[9]=tasks2->name!=NULL?(IPTR)tasks2->name:0; -- 2.11.4.GIT