Commit 412d12e0 authored by yoogx's avatar yoogx

* Include monitoring API in PolyORB-HI/C runtime and build

          infrastructure

          For issue #5
parent f1ff3ef4
...@@ -185,9 +185,12 @@ AC_OUTPUT([ ...@@ -185,9 +185,12 @@ AC_OUTPUT([
src/Makefile src/Makefile
src/drivers/Makefile src/drivers/Makefile
src/drivers/configuration/Makefile src/drivers/configuration/Makefile
src/monitoring/Makefile
src/monitoring/cheddar_scheduling/Makefile
include/Makefile include/Makefile
include/drivers/Makefile include/drivers/Makefile
include/drivers/configuration/Makefile include/drivers/configuration/Makefile
include/monitoring/Makefile
examples/Makefile examples/Makefile
examples/aadlv1/Makefile examples/aadlv1/Makefile
examples/aadlv1/d3.1.3-1/Makefile examples/aadlv1/d3.1.3-1/Makefile
......
AUTOMAKE_OPTIONS = no-dependencies AUTOMAKE_OPTIONS = no-dependencies
SUBDIRS=drivers SUBDIRS=drivers monitoring
EXTRA_DIST = $(srcdir)/po_hi_common.h \ EXTRA_DIST = $(srcdir)/po_hi_common.h \
$(srcdir)/po_hi_debug.h \ $(srcdir)/po_hi_debug.h \
$(srcdir)/po_hi_marshallers.h \ $(srcdir)/po_hi_marshallers.h \
......
...@@ -53,8 +53,8 @@ void __po_hi_gqueue_init (__po_hi_task_id id, ...@@ -53,8 +53,8 @@ void __po_hi_gqueue_init (__po_hi_task_id id,
* total_fifo_size gives the total size of the global queue * total_fifo_size gives the total size of the global queue
*/ */
void __po_hi_gqueue_store_out (__po_hi_task_id id, void __po_hi_gqueue_store_out (__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request); __po_hi_request_t* request);
/* Store a value for an OUT port. /* Store a value for an OUT port.
* *
...@@ -63,10 +63,10 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id, ...@@ -63,10 +63,10 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id,
* last argument is the request to store in the queue. * last argument is the request to store in the queue.
*/ */
int __po_hi_gqueue_send_output (__po_hi_task_id id, int __po_hi_gqueue_send_output (__po_hi_task_id id,
__po_hi_port_t port); __po_hi_port_t port);
/* /*
* Send a value for an out port. * Send a value for an out port.
* *
* The first argument is the id of the task which have the global * The first argument is the id of the task which have the global
* queue. The second argument is the number of port that will send the * queue. The second argument is the number of port that will send the
...@@ -74,11 +74,11 @@ int __po_hi_gqueue_send_output (__po_hi_task_id id, ...@@ -74,11 +74,11 @@ int __po_hi_gqueue_send_output (__po_hi_task_id id,
*/ */
int __po_hi_gqueue_get_value(__po_hi_task_id id, int __po_hi_gqueue_get_value(__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request); __po_hi_request_t* request);
/* /*
* Get the value on the specified port. * Get the value on the specified port.
* *
* The id parameter corresponds to the task-id in the local * The id parameter corresponds to the task-id in the local
* process. The port argument is the number of the port that received * process. The port argument is the number of the port that received
...@@ -87,7 +87,7 @@ int __po_hi_gqueue_get_value(__po_hi_task_id id, ...@@ -87,7 +87,7 @@ int __po_hi_gqueue_get_value(__po_hi_task_id id,
* but will not produce an error. * but will not produce an error.
*/ */
int __po_hi_gqueue_next_value(__po_hi_task_id id, int __po_hi_gqueue_next_value(__po_hi_task_id id,
__po_hi_local_port_t port); __po_hi_local_port_t port);
/* /*
* Dequeue the value on a port. The argument id is the task identifier * Dequeue the value on a port. The argument id is the task identifier
...@@ -96,7 +96,7 @@ int __po_hi_gqueue_next_value(__po_hi_task_id id, ...@@ -96,7 +96,7 @@ int __po_hi_gqueue_next_value(__po_hi_task_id id,
* you know what you do. * you know what you do.
*/ */
int __po_hi_gqueue_get_count(__po_hi_task_id id, int __po_hi_gqueue_get_count(__po_hi_task_id id,
__po_hi_local_port_t port); __po_hi_local_port_t port);
/* /*
* Return the number of events that are pending of a port. The first * Return the number of events that are pending of a port. The first
...@@ -104,7 +104,7 @@ int __po_hi_gqueue_get_count(__po_hi_task_id id, ...@@ -104,7 +104,7 @@ int __po_hi_gqueue_get_count(__po_hi_task_id id,
* argument is the port identifier (or port number) for the thread. * argument is the port identifier (or port number) for the thread.
*/ */
void __po_hi_gqueue_wait_for_incoming_event(__po_hi_task_id id, void __po_hi_gqueue_wait_for_incoming_event(__po_hi_task_id id,
__po_hi_local_port_t* port); __po_hi_local_port_t* port);
/* /*
* Wait until an event is received on any port for a given thread. The * Wait until an event is received on any port for a given thread. The
...@@ -114,8 +114,8 @@ void __po_hi_gqueue_wait_for_incoming_event(__po_hi_task_id id, ...@@ -114,8 +114,8 @@ void __po_hi_gqueue_wait_for_incoming_event(__po_hi_task_id id,
* the event. * the event.
*/ */
__po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request); __po_hi_request_t* request);
/* /*
* Store a value in a IN port. The first argument is the task * Store a value in a IN port. The first argument is the task
...@@ -124,14 +124,37 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, ...@@ -124,14 +124,37 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id,
* request that will be stored in the queue. * request that will be stored in the queue.
*/ */
__po_hi_request_t* __po_hi_gqueue_get_most_recent_value __po_hi_request_t* __po_hi_gqueue_get_most_recent_value
(const __po_hi_task_id task_id, (const __po_hi_task_id task_id,
const __po_hi_local_port_t local_port); const __po_hi_local_port_t local_port);
__po_hi_port_t __po_hi_gqueue_get_destination (const __po_hi_task_id task_id, const __po_hi_local_port_t local_port, const uint8_t destination_number); __po_hi_port_t __po_hi_gqueue_get_destination (const __po_hi_task_id task_id,
const __po_hi_local_port_t local_port,
const uint8_t destination_number);
uint8_t __po_hi_gqueue_get_destinations_number (const __po_hi_task_id task_id, const __po_hi_local_port_t local_port); uint8_t __po_hi_gqueue_get_destinations_number (const __po_hi_task_id task_id,
const __po_hi_local_port_t local_port);
/*
* Access the size of a port. The first argument is the task
* identifier in the local process. The second argument is the port
* identifier for the local thread.
*/
__po_hi_int8_t __po_hi_gqueue_get_port_size(const __po_hi_task_id id,
const __po_hi_local_port_t port);
/*
* Access the used size of a port. The first argument is the task
* identifier in the local process. The second argument is the port
* identifier for the local thread.
*/
__po_hi_int8_t __po_hi_gqueue_used_size( __po_hi_task_id id, __po_hi_local_port_t port);
__po_hi_int8_t po_hi_gqueues_queue_is_empty(__po_hi_task_id id);
__po_hi_request_t* __po_hi_gqueues_get_request(__po_hi_task_id id, __po_hi_local_port_t port);
#endif /* __PO_HI_GQUEUE_H__ */ #endif /* __PO_HI_GQUEUE_H__ */
AUTOMAKE_OPTIONS = no-dependencies AUTOMAKE_OPTIONS = no-dependencies
SUBDIRS=drivers SUBDIRS=drivers monitoring
C_FILES = $(srcdir)/po_hi_task.c \ C_FILES = $(srcdir)/po_hi_task.c \
$(srcdir)/po_hi_main.c \ $(srcdir)/po_hi_main.c \
......
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
#include <native/mutex.h> #include <native/mutex.h>
#endif #endif
#if defined (MONITORING) /* Headers from run-time verification */
#include <trace_manager.hh>
#endif
#define __PO_HI_GQUEUE_OUT_PORT constant_out_identifier #define __PO_HI_GQUEUE_OUT_PORT constant_out_identifier
/* give a default value to the out port */ /* give a default value to the out port */
...@@ -225,7 +227,6 @@ void __po_hi_gqueue_init (__po_hi_task_id id, ...@@ -225,7 +227,6 @@ void __po_hi_gqueue_init (__po_hi_task_id id,
#endif #endif
} }
void __po_hi_gqueue_store_out (__po_hi_task_id id, void __po_hi_gqueue_store_out (__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request) __po_hi_request_t* request)
...@@ -238,8 +239,6 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id, ...@@ -238,8 +239,6 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id,
__PO_HI_DEBUG_DEBUG ("__po_hi_gqueue_store_out() from task %d on port %d\n", id, port); __PO_HI_DEBUG_DEBUG ("__po_hi_gqueue_store_out() from task %d on port %d\n", id, port);
} }
__po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request) __po_hi_request_t* request)
...@@ -354,6 +353,7 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id, ...@@ -354,6 +353,7 @@ __po_hi_uint8_t __po_hi_gqueue_store_in (__po_hi_task_id id,
return __PO_HI_SUCCESS; return __PO_HI_SUCCESS;
} }
void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id, void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
__po_hi_local_port_t* port) __po_hi_local_port_t* port)
{ {
...@@ -424,6 +424,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id, ...@@ -424,6 +424,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
__DEBUGMSG ("[GQUEUE] Gogo kiki\n"); __DEBUGMSG ("[GQUEUE] Gogo kiki\n");
*port = __po_hi_gqueues_global_history[id][__po_hi_gqueues_global_history_offset[id]]; *port = __po_hi_gqueues_global_history[id][__po_hi_gqueues_global_history_offset[id]];
#if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX) #if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]); pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE) #elif defined (XENO_NATIVE)
...@@ -442,6 +443,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id, ...@@ -442,6 +443,7 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
} }
int __po_hi_gqueue_get_count( __po_hi_task_id id, __po_hi_local_port_t port) int __po_hi_gqueue_get_count( __po_hi_task_id id, __po_hi_local_port_t port)
{ {
if (__po_hi_gqueues_sizes[id][port] == __PO_HI_GQUEUE_FIFO_INDATA) if (__po_hi_gqueues_sizes[id][port] == __PO_HI_GQUEUE_FIFO_INDATA)
...@@ -454,6 +456,7 @@ int __po_hi_gqueue_get_count( __po_hi_task_id id, __po_hi_local_port_t port) ...@@ -454,6 +456,7 @@ int __po_hi_gqueue_get_count( __po_hi_task_id id, __po_hi_local_port_t port)
} }
} }
int __po_hi_gqueue_get_value (__po_hi_task_id id, int __po_hi_gqueue_get_value (__po_hi_task_id id,
__po_hi_local_port_t port, __po_hi_local_port_t port,
__po_hi_request_t* request) __po_hi_request_t* request)
...@@ -495,6 +498,7 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id, ...@@ -495,6 +498,7 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
#if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX) #if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
pthread_cond_wait (&__po_hi_gqueues_conds[id], pthread_cond_wait (&__po_hi_gqueues_conds[id],
&__po_hi_gqueues_mutexes[id]); &__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE) #elif defined (XENO_NATIVE)
rt_cond_wait (&__po_hi_gqueues_conds[id], &__po_hi_gqueues_mutexes[id], TM_INFINITE); rt_cond_wait (&__po_hi_gqueues_conds[id], &__po_hi_gqueues_mutexes[id], TM_INFINITE);
#elif defined (RTEMS_PURE) #elif defined (RTEMS_PURE)
...@@ -512,9 +516,14 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id, ...@@ -512,9 +516,14 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
} }
} }
#if defined (MONITORING)
update_sporadic_dispatch (id, port);
#endif
if (__po_hi_gqueues_used_size[id][port] == 0) if (__po_hi_gqueues_used_size[id][port] == 0)
{ {
memcpy (request, ptr, sizeof (__po_hi_request_t)); memcpy (request, ptr, sizeof (__po_hi_request_t));
//update_runtime (id, port, ptr);
} }
else else
{ {
...@@ -525,28 +534,6 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id, ...@@ -525,28 +534,6 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
__PO_HI_DEBUG_INFO ("[GQUEUE] Task %d get a value on port %d\n", id, port); __PO_HI_DEBUG_INFO ("[GQUEUE] Task %d get a value on port %d\n", id, port);
/*
* As this part of the code is now considered as stable, we don't print debug output
*
__DEBUGMSG ("RECEIVED vars in gqueue: |");
{
int s;
int i;
uint8_t* tmp;
tmp = (unsigned int*) &request->vars;
s = sizeof (request->vars);
for (i = 0 ; i < s ; i++)
{
printf("%x", *tmp);
tmp++;
fflush (stdout);
}
}
__DEBUGMSG ("|\n");
#endif
*/
#if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX) #if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]); pthread_mutex_unlock (&__po_hi_gqueues_mutexes[id]);
#elif defined (XENO_NATIVE) #elif defined (XENO_NATIVE)
...@@ -570,7 +557,6 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port) ...@@ -570,7 +557,6 @@ int __po_hi_gqueue_next_value (__po_hi_task_id id, __po_hi_local_port_t port)
rtems_status_code ret; rtems_status_code ret;
#endif #endif
/* incomplete semantics, should discriminate and report whether /* incomplete semantics, should discriminate and report whether
there is a next value or not */ there is a next value or not */
...@@ -649,3 +635,38 @@ __po_hi_port_t __po_hi_gqueue_get_destination (const __po_hi_task_id task_id, co ...@@ -649,3 +635,38 @@ __po_hi_port_t __po_hi_gqueue_get_destination (const __po_hi_task_id task_id, co
{ {
return (__po_hi_gqueues_destinations[task_id][local_port][destination_number]); return (__po_hi_gqueues_destinations[task_id][local_port][destination_number]);
} }
__po_hi_int8_t __po_hi_gqueue_get_port_size( __po_hi_task_id id, __po_hi_local_port_t port)
{
return __po_hi_gqueues_sizes[id][port];
}
__po_hi_int8_t __po_hi_gqueue_used_size( __po_hi_task_id id, __po_hi_local_port_t port)
{
return __po_hi_gqueues_used_size[id][port];
}
__po_hi_int8_t po_hi_gqueues_queue_is_empty( __po_hi_task_id id)
{
return __po_hi_gqueues_queue_is_empty[id];
}
__po_hi_request_t*
__po_hi_gqueues_get_request(__po_hi_task_id id, __po_hi_local_port_t port)
{
__po_hi_request_t* request;
__po_hi_request_t* ptr;
if (__po_hi_gqueues_used_size[id][port] == 0)
{
memcpy (request, ptr, sizeof (__po_hi_request_t));
//update_runtime (id, port, ptr);
}
else
{
ptr = ((__po_hi_request_t *) &__po_hi_gqueues[id][port]) + __po_hi_gqueues_first[id][port] + __po_hi_gqueues_offsets[id][port];
memcpy (request, ptr, sizeof (__po_hi_request_t));
} return request;
}
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
* Copyright (C) 2010-2014 ESA & ISAE. * Copyright (C) 2010-2014 ESA & ISAE.
*/ */
#include <deployment.h> #include <deployment.h>
/* included files from the generated code */ /* included files from the generated code */
...@@ -22,6 +21,11 @@ ...@@ -22,6 +21,11 @@
#include <po_hi_utils.h> #include <po_hi_utils.h>
/* included files from PolyORB-HI-C */ /* included files from PolyORB-HI-C */
#if defined (MONITORING)
#include <trace_manager.hh>
#endif
/* Headers from run-time verification */
#if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX) #if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
#include <pthread.h> #include <pthread.h>
/* POSIX files */ /* POSIX files */
...@@ -59,7 +63,7 @@ RT_TASK* main_task_id; ...@@ -59,7 +63,7 @@ RT_TASK* main_task_id;
* between the main task and the other tasks. * between the main task and the other tasks.
* *
* For that reason, the main task does not wait for * For that reason, the main task does not wait for
* the initialization of the other tasks. The * the initialization of the other tasks. The
* __po_hi_wait_initialization just passes when it is * __po_hi_wait_initialization just passes when it is
* called from the main task. To do that, we need * called from the main task. To do that, we need
* to differentiate the main task from the other, * to differentiate the main task from the other,
...@@ -97,7 +101,7 @@ int __po_hi_initialize_early () ...@@ -97,7 +101,7 @@ int __po_hi_initialize_early ()
#if defined (XENO_POSIX) || defined (XENO_NATIVE) #if defined (XENO_POSIX) || defined (XENO_NATIVE)
/* /*
* Once initialization has been done, we avoid ALL * Once initialization has been done, we avoid ALL
* potential paging operations that can introduce * potential paging operations that can introduce
* some indeterministic timing behavior. * some indeterministic timing behavior.
*/ */
...@@ -186,7 +190,7 @@ int __po_hi_initialize_early () ...@@ -186,7 +190,7 @@ int __po_hi_initialize_early ()
#ifdef RTEMS_PURE #ifdef RTEMS_PURE
__DEBUGMSG ("[MAIN] Create a barrier that wait for %d tasks\n", __po_hi_nb_tasks_to_init); __DEBUGMSG ("[MAIN] Create a barrier that wait for %d tasks\n", __po_hi_nb_tasks_to_init);
ret = rtems_barrier_create (rtems_build_name ('B', 'A', 'R', 'M'), RTEMS_BARRIER_AUTOMATIC_RELEASE, __po_hi_nb_tasks_to_init, &__po_hi_main_initialization_barrier); ret = rtems_barrier_create (rtems_build_name ('B', 'A', 'R', 'M'), RTEMS_BARRIER_AUTOMATIC_RELEASE, __po_hi_nb_tasks_to_init, &__po_hi_main_initialization_barrier);
if (ret != RTEMS_SUCCESSFUL) if (ret != RTEMS_SUCCESSFUL)
{ {
...@@ -226,7 +230,7 @@ int __po_hi_initialize () ...@@ -226,7 +230,7 @@ int __po_hi_initialize ()
#include <po_hi_transport.h> #include <po_hi_transport.h>
#include <xm.h> #include <xm.h>
__po_hi_port_kind_t pkind; __po_hi_port_kind_t pkind;
__po_hi_port_t tmp; __po_hi_port_t tmp;
__po_hi_node_t tmpnode; __po_hi_node_t tmpnode;
__po_hi_node_t mynode; __po_hi_node_t mynode;
...@@ -284,6 +288,14 @@ int __po_hi_initialize () ...@@ -284,6 +288,14 @@ int __po_hi_initialize ()
} }
#endif #endif
/*!
* Initialize the monitoring trace if needed
*/
#if defined (MONITORING)
trace_initialize ();
#endif
return (__PO_HI_SUCCESS); return (__PO_HI_SUCCESS);
} }
...@@ -310,7 +322,7 @@ int __po_hi_wait_initialization () ...@@ -310,7 +322,7 @@ int __po_hi_wait_initialization ()
__po_hi_initialized_tasks++; __po_hi_initialized_tasks++;
__DEBUGMSG ("[MAIN] %d task(s) initialized (total to init =%d)\n", __po_hi_initialized_tasks, __po_hi_nb_tasks_to_init); __DEBUGMSG ("[MAIN] %d task(s) initialized (total to init =%d)\n", __po_hi_initialized_tasks, __po_hi_nb_tasks_to_init);
while (__po_hi_initialized_tasks < __po_hi_nb_tasks_to_init) while (__po_hi_initialized_tasks < __po_hi_nb_tasks_to_init)
{ {
pthread_cond_wait (&cond_init, &mutex_init); pthread_cond_wait (&cond_init, &mutex_init);
...@@ -327,11 +339,11 @@ int __po_hi_wait_initialization () ...@@ -327,11 +339,11 @@ int __po_hi_wait_initialization ()
__po_hi_initialized_tasks++; __po_hi_initialized_tasks++;
__DEBUGMSG ("[MAIN] %d task(s) initialized (total to init =%d)\n", __po_hi_initialized_tasks, __po_hi_nb_tasks_to_init); __DEBUGMSG ("[MAIN] %d task(s) initialized (total to init =%d)\n", __po_hi_initialized_tasks, __po_hi_nb_tasks_to_init);
while (__po_hi_initialized_tasks < __po_hi_nb_tasks_to_init) while (__po_hi_initialized_tasks < __po_hi_nb_tasks_to_init)
{ {
LeaveCriticalSection (&__po_hi_main_initialization_critical_section); LeaveCriticalSection (&__po_hi_main_initialization_critical_section);
WaitForSingleObject (__po_hi_main_initialization_event, INFINITE); WaitForSingleObject (__po_hi_main_initialization_event, INFINITE);
EnterCriticalSection (&__po_hi_main_initialization_critical_section); EnterCriticalSection (&__po_hi_main_initialization_critical_section);
} }
...@@ -339,7 +351,7 @@ int __po_hi_wait_initialization () ...@@ -339,7 +351,7 @@ int __po_hi_wait_initialization ()
LeaveCriticalSection (&__po_hi_main_initialization_critical_section); LeaveCriticalSection (&__po_hi_main_initialization_critical_section);
return (__PO_HI_SUCCESS); return (__PO_HI_SUCCESS);
#elif defined (RTEMS_PURE) #elif defined (RTEMS_PURE)
rtems_status_code ret; rtems_status_code ret;
__DEBUGMSG ("[MAIN] Task wait for the barrier\n"); __DEBUGMSG ("[MAIN] Task wait for the barrier\n");
...@@ -375,7 +387,7 @@ int __po_hi_wait_initialization () ...@@ -375,7 +387,7 @@ int __po_hi_wait_initialization ()
__po_hi_initialized_tasks++; __po_hi_initialized_tasks++;
__DEBUGMSG ("[MAIN] %d task(s) initialized (total to init =%d)\n", __po_hi_initialized_tasks, __po_hi_nb_tasks_to_init); __DEBUGMSG ("[MAIN] %d task(s) initialized (total to init =%d)\n", __po_hi_initialized_tasks, __po_hi_nb_tasks_to_init);
while (__po_hi_initialized_tasks < __po_hi_nb_tasks_to_init) while (__po_hi_initialized_tasks < __po_hi_nb_tasks_to_init)
{ {
rt_cond_wait (&cond_init, &mutex_init, TM_INFINITE); rt_cond_wait (&cond_init, &mutex_init, TM_INFINITE);
...@@ -393,9 +405,9 @@ int __po_hi_wait_initialization () ...@@ -393,9 +405,9 @@ int __po_hi_wait_initialization ()
void __po_hi_wait_end_of_instrumentation () void __po_hi_wait_end_of_instrumentation ()
{ {
#ifdef RTEMS_PURE #ifdef RTEMS_PURE
rtems_task_wake_after (10000000 / _TOD_Microseconds_per_tick); rtems_task_wake_after (10000000 / _TOD_Microseconds_per_tick);
#else #else
#include <po_hi_time.h> #include <po_hi_time.h>
#include <unistd.h> #include <unistd.h>
__po_hi_time_t now; __po_hi_time_t now;
......
...@@ -48,6 +48,11 @@ ...@@ -48,6 +48,11 @@
#include <po_hi_utils.h> #include <po_hi_utils.h>
/* Header files in PolyORB-HI */ /* Header files in PolyORB-HI */
#if defined (MONITORING)
#include <trace_manager.hh>
#endif
/* Headers from run-time verification */
#include <deployment.h> #include <deployment.h>
/* Header files from generated code */ /* Header files from generated code */
...@@ -90,6 +95,7 @@ __po_hi_task_t tasks[__PO_HI_NB_TASKS]; ...@@ -90,6 +95,7 @@ __po_hi_task_t tasks[__PO_HI_NB_TASKS];
HANDLE __po_hi_tasks_array[__PO_HI_NB_TASKS]; HANDLE __po_hi_tasks_array[__PO_HI_NB_TASKS];
#endif #endif
void __po_hi_wait_for_tasks () void __po_hi_wait_for_tasks ()
{ {
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX) #if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
...@@ -170,12 +176,21 @@ int __po_hi_compute_next_period (__po_hi_task_id task) ...@@ -170,12 +176,21 @@ int __po_hi_compute_next_period (__po_hi_task_id task)
#endif #endif
} }
int __po_hi_wait_for_next_period (__po_hi_task_id task) int __po_hi_wait_for_next_period (__po_hi_task_id task)
{ {
#if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX) #if defined (POSIX) || defined (RTEMS_POSIX) || defined (XENO_POSIX)
int ret; int ret;
__PO_HI_INSTRUMENTATION_VCD_WRITE("0t%d\n", task); __PO_HI_INSTRUMENTATION_VCD_WRITE("0t%d\n", task);
__po_hi_task_delay_until (&(tasks[task].timer), task); __po_hi_task_delay_until (&(tasks[task].timer), task);
/*!
* Entry ports monitoring at dispatch if MONITORING is defined
*/
#if defined (MONITORING)
update_periodic_dispatch(task);
#endif
if ( (ret = __po_hi_compute_next_period (task)) != 1) if ( (ret = __po_hi_compute_next_period (task)) != 1)
{ {
return (__PO_HI_ERROR_CLOCK); return (__PO_HI_ERROR_CLOCK);
...@@ -355,6 +370,7 @@ pthread_t __po_hi_posix_create_thread (__po_hi_priority_t priority, ...@@ -355,6 +370,7 @@ pthread_t __po_hi_posix_create_thread (__po_hi_priority_t priority,
return tid; return tid;
} }
int __po_hi_posix_initialize_task (__po_hi_task_t* task) int __po_hi_posix_initialize_task (__po_hi_task_t* task)
{ {
if (pthread_mutex_init (&(task->mutex), NULL) != 0) if (pthread_mutex_init (&(task->mutex), NULL) != 0)
...@@ -452,7 +468,6 @@ RT_TASK __po_hi_xenomai_create_thread (__po_hi_priority_t priority, ...@@ -452,7 +468,6 @@ RT_TASK __po_hi_xenomai_create_thread (__po_hi_priority_t priority,
} }
#endif #endif
int __po_hi_create_generic_task (const __po_hi_task_id id, int __po_hi_create_generic_task (const __po_hi_task_id id,
const __po_hi_time_t* period, const __po_hi_time_t* period,
const __po_hi_priority_t priority, const __po_hi_priority_t priority,
...@@ -511,6 +526,7 @@ int __po_hi_create_generic_task (const __po_hi_task_id id, ...@@ -511,6 +526,7 @@ int __po_hi_create_generic_task (const __po_hi_task_id id,
return (__PO_HI_SUCCESS); return (__PO_HI_SUCCESS);
} }
int __po_hi_create_periodic_task (const __po_hi_task_id id, int __po_hi_create_periodic_task (const __po_hi_task_id id,
const __po_hi_time_t* period, const __po_hi_time_t* period,
const __po_hi_priority_t priority, const __po_hi_priority_t priority,
...@@ -518,6 +534,14 @@ int __po_hi_create_periodic_task (const __po_hi_task_id id, ...@@ -518,6 +534,14 @@ int __po_hi_create_periodic_task (const __po_hi_task_id id,
const __po_hi_int8_t core_id, const __po_hi_int8_t core_id,
void* (*start_routine)(void)) void* (*start_routine)(void))
{ {
/*
* Send Task type to trace manager, if there is monitoring.
*/
#if defined (MONITORING)
periodic_task_creation(id);
#endif
if (__po_hi_create_generic_task( id, period , priority , stack_size, core_id, start_routine, NULL) != 1) if (__po_hi_create_generic_task( id, period , priority , stack_size, core_id, start_routine, NULL) != 1)
{ {
__DEBUGMSG ("ERROR when creating generic task (task id=%d)\n", id); __DEBUGMSG ("ERROR when creating generic task (task id=%d)\n", id);
...@@ -565,6 +589,13 @@ int __po_hi_create_sporadic_task (const __po_hi_task_id id, ...@@ -565,6 +589,13 @@ int __po_hi_create_sporadic_task (const __po_hi_task_id id,
const __po_hi_int8_t core_id, const __po_hi_int8_t core_id,
void* (*start_routine)(void) ) void* (*start_routine)(void) )
{ {
/*
* Send Task type to trace manager, if there is monitoring.
*/
#if defined (MONITORING)
sporadic_task_creation(id);
#endif
/* /*
* Create generic task which will execute the routine given in the * Create generic task which will execute the routine given in the
* last parameter. Typically, a sporadic thread will wait on a * last parameter. Typically, a sporadic thread will wait on a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment