POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/core/instrumentation.c
Go to the documentation of this file.
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Wed Sep 30 17:30:02 2009 
00015  */
00016 
00017 #ifdef POK_NEEDS_INSTRUMENTATION
00018 
00019 #include <core/thread.h>
00020 #include <core/partition.h>
00021 #include <core/time.h>
00022 #include <libc.h>
00023 
00024 uint8_t pok_instrumentation_task_is_init = 0;
00025 uint8_t pok_instrumentation_partition_is_init = 0;
00026 
00027 void pok_instrumentation_task_archi (const uint32_t id)
00028 {
00029    /*
00030     * We don't print the first thread, this is the init thread
00031     */
00032    if (id == pok_partitions[pok_threads[id].partition].thread_index_low)
00033    {
00034       return;
00035    }
00036 
00037    if (pok_instrumentation_task_is_init == 0)
00038    {
00039       printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] </address_spaces>\n");
00040       printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <tasks>\n");
00041    }
00042 
00043    pok_instrumentation_task_is_init = 1;
00044 
00045    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <task task_type=\"PERIODIC_TYPE\">\n");
00046    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <cpu_name>pokkernel</cpu_name>\n");
00047    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <address_space_name>partition%d</address_space_name>\n", pok_threads[id].partition);
00048    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <address_space_name>partition%d</address_space_name>\n", pok_threads[id].partition);
00049    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <name>task%d</name>\n", id);
00050    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <capacity>%d</capacity>\n", pok_threads[id].time_capacity);
00051    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <start_time>0</start_time>\n");
00052    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <policy>SCHED_FIFO</policy>\n");
00053    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <deadline>%d</deadline>\n", pok_threads[id].deadline);
00054    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <criticality>0</criticality>\n");
00055    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <context_switch_overhead>0</context_switch_overhead>\n");
00056    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <blocking_time>0</blocking_time>\n");
00057    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <priority>1</priority>\n");
00058    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <text_memory_size>0</text_memory_size>\n");
00059    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <stack_memory_size>0</stack_memory_size>\n");
00060    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <period>%d</period>\n", pok_threads[id].period);
00061    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]     <jitter>0</jitter>\n");
00062    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] </task>\n");
00063 }
00064 
00065 void pok_instrumentation_partition_archi (const uint8_t id)
00066 {
00067    if (pok_instrumentation_partition_is_init == 0)
00068    {
00069       printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <address_spaces>\n");
00070    }
00071 
00072    pok_instrumentation_partition_is_init = 1;
00073 
00074    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <address_space>\n");
00075    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    <name>partition%d</name>\n", id);
00076    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    <cpu_name>pokkernel</cpu_name>\n");
00077    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    <text_memory_size> 0</text_memory_size>\n");
00078    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    <stack_memory_size> 0</stack_memory_size>\n");
00079    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    <data_memory_size> 0</data_memory_size>\n");
00080    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    <heap_memory_size> 0</heap_memory_size>\n");
00081    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    <scheduler quantum= \"%d\">", pok_partitions[id].period);
00082    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI]    POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL </scheduler>\n");
00083    printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] </address_space>\n");
00084 }
00085 
00086 void pok_instrumentation_running_task (const uint32_t id)
00087 {
00088    printf ("[INSTRUMENTATION][CHEDDAR][EVENTS] <running_task>   ");
00089    printf ("%d", POK_GETTICK() );
00090    printf ("  task%d", id);
00091    printf ("</running_task>\n");
00092 }
00093 
00094 #endif