POK(kernelpart)
instrumentation.c
Go to the documentation of this file.
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Wed Sep 30 17:30:02 2009
15  */
16 
17 #ifdef POK_NEEDS_INSTRUMENTATION
18 
19 #include <core/thread.h>
20 #include <core/partition.h>
21 #include <core/time.h>
22 #include <libc.h>
23 
24 uint8_t pok_instrumentation_task_is_init = 0;
25 uint8_t pok_instrumentation_partition_is_init = 0;
26 
27 void pok_instrumentation_task_archi (const uint32_t id)
28 {
29  /*
30  * We don't print the first thread, this is the init thread
31  */
32  if (id == pok_partitions[pok_threads[id].partition].thread_index_low)
33  {
34  return;
35  }
36 
37  if (pok_instrumentation_task_is_init == 0)
38  {
39  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] </address_spaces>\n");
40  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <tasks>\n");
41  }
42 
43  pok_instrumentation_task_is_init = 1;
44 
45  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <task task_type=\"PERIODIC_TYPE\">\n");
46  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <cpu_name>pokkernel</cpu_name>\n");
47  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <address_space_name>partition%d</address_space_name>\n", pok_threads[id].partition);
48  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <address_space_name>partition%d</address_space_name>\n", pok_threads[id].partition);
49  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <name>task%d</name>\n", id);
50  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <capacity>%d</capacity>\n", pok_threads[id].time_capacity);
51  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <start_time>0</start_time>\n");
52  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <policy>SCHED_FIFO</policy>\n");
53  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <deadline>%d</deadline>\n", pok_threads[id].deadline);
54  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <criticality>0</criticality>\n");
55  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <context_switch_overhead>0</context_switch_overhead>\n");
56  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <blocking_time>0</blocking_time>\n");
57  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <priority>1</priority>\n");
58  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <text_memory_size>0</text_memory_size>\n");
59  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <stack_memory_size>0</stack_memory_size>\n");
60  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <period>%d</period>\n", pok_threads[id].period);
61  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <jitter>0</jitter>\n");
62  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] </task>\n");
63 }
64 
65 void pok_instrumentation_partition_archi (const uint8_t id)
66 {
67  if (pok_instrumentation_partition_is_init == 0)
68  {
69  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <address_spaces>\n");
70  }
71 
72  pok_instrumentation_partition_is_init = 1;
73 
74  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <address_space>\n");
75  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <name>partition%d</name>\n", id);
76  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <cpu_name>pokkernel</cpu_name>\n");
77  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <text_memory_size> 0</text_memory_size>\n");
78  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <stack_memory_size> 0</stack_memory_size>\n");
79  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <data_memory_size> 0</data_memory_size>\n");
80  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <heap_memory_size> 0</heap_memory_size>\n");
81  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] <scheduler quantum= \"%d\">", pok_partitions[id].period);
82  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL </scheduler>\n");
83  printf ("[INSTRUMENTATION][CHEDDAR][ARCHI] </address_space>\n");
84 }
85 
86 void pok_instrumentation_running_task (const uint32_t id)
87 {
88  printf ("[INSTRUMENTATION][CHEDDAR][EVENTS] <running_task> ");
89  printf ("%d", POK_GETTICK() );
90  printf (" task%d", id);
91  printf ("</running_task>\n");
92 }
93 
94 #endif