This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

make a list of all BIOS TSK



Hi, 

Hi,

I'd like to print a list of all tasks created in bios.   So far, I can only do it by explicitly listing each one.   How can I get BIOS to tell me instead?

myTaskList[0] = &TSK_idle;

myTaskList[1] = &testtask_obj;

LOG_printf(&taskname_log, "Name Test  %s", myTaskList[0]->name);

LOG_printf(&taskname_log, "Name Test  %s", myTaskList[1]->name);

 

How can i get Bios to tell me:

1) how many tasks there are and

2) Their handles?

Is there a pointer to an array of TSK?

Br,
Matt

  • You can find that info in the header file generated by DSP/BIOS. It is "namecfg.h" where "name" is the name of the tcf file.

     

     

  • Hi Mariana,

    Thanks for the quick reply!.      Actually, that is where I got the information from initially.   Is there someway I can have a pointer to the TSK information in the code?   I am trying to write the tasks out dynamically.

    For instance, If I launch the kernel viewer, under TSK, it tells how many tasks are currently created, then lists each one.   How can I get access to this structure at runtime?

    Br,
    Matt

  •  

    Hum... not sure if it is possible.

    What do you mean by "I am trying to write the tasks out dynamically."

    If I understand better why do you need the list and what you are trying to achieve, I might think of a solution...

  • Hi Mariana,

    I would like to be able to generate a list of tasks and their handles to be used in an external profiling tool which takes task handles and timestamps as input (generated from a memory dump).  The task handles will vary from build to build, as will the tasks themselves (its a larger development group).  When I can output the task names and ids for a given build, then the profiling tool can draw its graphs etc.

    Thanks,
    Matt

  • Hi,

    Approaching this from a brute force means,  I've written a program to search the memory.  It found my TSK handles in a structure of QUE objects called KNL_queues (externed with "extern far QUE_Obj KNL_queues[ ];").   I've printed them (through some other function called 'QUE_print' (outputting data to some array called SYS_PUTCBEG) and found they seem to correspond to the 16 priority levels (including suspended) of the TSK system.

    I was really hoping for something more simple - I can loop through this structure and recover the information though.

    I'm sure someone has run into this before and found a more appropriate solution without bit-slogging?  I think this is fundamental information for any OS - let me know if I used the wrong hammer.

    Br,
    Matt

  • This is probably not the best way to do it, but here it is.   myTaskList will fill up with all  of the TSK handles and count will be the total number of tasks.

    Still would like to know if there is some convienient way to figure this through bios?

    Matt

     

    TSK_Handle myTaskList[4];

    extern far QUE_Obj KNL_queues[];

    QUE_Elem *elem;   
        count = 0;
        for(i=4; i<20; i++)                        // go through all priorities
        {
            if(!QUE_empty(&KNL_queues[i]))        // if queue not empty
            {
                elem = QUE_head(&KNL_queues[i]);
                myTaskList[count++] = (TSK_Handle)elem;
               
                elem = elem->next;
                while(elem != &KNL_queues[i])
                {
                    myTaskList[count++] = (TSK_Handle)elem;
                    elem = elem->next;
                }
               
            }   
        }

  • Hello,

    I would suggest considering the hook functions which you can have system-wide for BIOS and will be called automatically once a task is created or deleted

    This is performed using the HOOK module.

    See page 519 / 522 (TSK_create, TSK_delete) and par. 2.10 of the BIOS API guide, spru403o

    In my understanding this should work for both static and dynamically created tasks (either during BIOS_init, or at runtime if you create or delete a task)

    Since the TSK handle is one of the parameters of this custom function, you can query the task characteristics, and add the values of interest as desired in your custom logging structure

     

    Note: be aware that BIOS has some (a couple, if I recall well) of internal task objects which are not user tasks, but used for internal purposes.

    They will not have task names assigned (like you could choose for user tasks, like TSK0, TSK1 and so on)

    So when composing statistics in this way, don't be surprised if you discover two tasks more than the user defined ones [:)]