Commit 164f5a73 authored by Antonia Francis's avatar Antonia Francis

Merge branch 'master' into doxygen

parents 0d41eba2 a9ea08f6
Julien Delange <delange@enst.fr>
Jerome Hugues <hugues@enst.fr>
Laurent Pautet <pautet@enst.fr>
Current maintainer is
- Jerome Hugues
Contributors
- Antonia Francis (2018)
- Hariprasath Shanmugasundaram (2017)
The initial design team of PolyORB-HI/C was
- Julien Delange (up to 2016)
- Jerome Hugues
- Laurent Pautet (up to 2009)
......@@ -4,7 +4,7 @@ SUBDIRS=
EXTRA_DIST = $(srcdir)/hash.hh $(srcdir)/meta.hh $(srcdir)/state.hh \
$(srcdir)/trace.hh $(srcdir)/local_configuration.hh \
$(srcdir)/remote_configuration.hh $(srcdir)/state_types.hh \
$(srcdir)/trace_manager.hh
$(srcdir)/trace_manager.h
CLEANFILES = *~
......
#include <deployment.h>
#include <request.h>
#include <po_hi_time.h>
/** Nature of the task traced */
typedef enum {
PERIODIC = 1,
SPORADIC = -1,
ANY = 0,
} events;
/** Step in which the traced-task is */
typedef enum {
/* The task has just been creatd */
CREATION = 0,
STORE_OUT = 1,
TRANSPORT_SEND = 2,
WAIT_FOR = 3,
GET_VALUE = 4,
} steps;
/** Structure stored when an event is recorded */
typedef struct characteristics characteristics;
struct characteristics{
events event;
steps status;
__po_hi_task_id task_id;
__po_hi_port_t global_port_src;
__po_hi_port_t global_port_dest;
__po_hi_local_port_t loc_port_src;
__po_hi_local_port_t loc_port_dest;
__po_hi_time_t mytime;
__po_hi_request_t *p_request;
};
/** Function initializing the mutex */
void trace_initialize();
/** Function used to trace a task. */
/* The stored events (under the form of "characteristics" structures) are sent in an array
* and written in the history.txt file.
* t_id is the task_id.
* p_src and p_dest are the GLOBAL source and destination ports if they exists / are retrievable.
* port_src and port_dest are the LOCAL source and destination ports if they exists / are retrievable.
* p_req is a pointer toward the request if it exists and is retrievable.
* CONVENTION :
* If an operation is made without movement, that is to say with no source or destination (such as waiting for an event),
* the concerned port is stored in the "src" port.
*/
int record_event
(int event,
int status,
__po_hi_task_id t_id,
__po_hi_port_t p_src,
__po_hi_port_t p_dest,
__po_hi_local_port_t port_src,
__po_hi_local_port_t port_dest,
__po_hi_request_t *p_req);
......@@ -183,18 +183,15 @@ check-linuxtaste:
ifeq ($(MONITORING), true)
MONITORING_OBJS = trace_manager.o remote_configuration.o
PO_HI_CPPOBJS += $(MONITORING_OBJS)
PO_HI_OBJS += um_threads.o
MONITORING_OBJS = trace_manager.o
PO_HI_OBJS += $(MONITORING_OBJS)
CFLAGS += -DMONITORING
INCLUDE += -I$(LOCAL_RUNTIME_PATH)/src \
-I$(LOCAL_RUNTIME_PATH)/src/monitoring \
-I$(LOCAL_RUNTIME_PATH)/include \
-I$(LOCAL_RUNTIME_PATH)/include/monitoring \
-I$(LOCAL_RUNTIME_PATH)/src/monitoring/cheddar_scheduling
CPPFLAGS += -std=c++1y -g @BOOST_CPPFLAGS@
LDFLAGS += -lstdc++
endif
hyperperiod-cheddar:
......
AUTOMAKE_OPTIONS = no-dependencies
SUBDIRS= cheddar_scheduling
CPP_FILES = $(srcdir)/trace_manager.cc \
CPP_FILES = $(srcdir)/trace_manager.c \
$(srcdir)/remote_configuration.cc
PYTHON_FILES = $(srcdir)/make_cheddar.py \
......
#include <trace_manager.h>
//#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <request.h>
//#include <pthread.h>
#include <deployment.h>
#include <string.h>
#include <po_hi_debug.h>
#include <po_hi_task.h>
#include <po_hi_protected.h>
#include <po_hi_gqueue.h>
#include <po_hi_returns.h>
#include <activity.h>
#include <request.h>
#define MAX_STRUCT 10
__po_hi_mutex_t __po_hi_c_trace_mutex;
/** Array receiving all tasks */
characteristics task_log[MAX_STRUCT];
/** Integer allowing to move in the task_log array */
int nb_struct = 0;
/** Initializing the mutex in the main.c */
void trace_initialize(){
__po_hi_mutex_init (&__po_hi_c_trace_mutex,__PO_HI_MUTEX_REGULAR, 0);
}
/** Recording all events, trace_managing */
int record_event(int event, int stat, __po_hi_task_id t_id, __po_hi_port_t p_src, __po_hi_port_t p_dest, __po_hi_local_port_t port_src,__po_hi_local_port_t port_dest, __po_hi_request_t *p_req){
/** CREATION OF STREAM */
printf("IN PROGRAM");
FILE *history = NULL;
/** CREATION OF THE STRUCTURE TO BE SENT TO TASK_LOG */
characteristics my_task;
characteristics *p_my_task = &my_task;
/** EVENT */
events ev = event;
p_my_task->event = ev;
/** STATUS */
steps step = stat;
p_my_task->status = step;
/** TASK ID */
p_my_task->task_id = t_id;
/** GLOBAL PORT SRC */
p_my_task->global_port_src = p_src;
/** GLOBAL PORT DEST */
p_my_task->global_port_dest = p_dest;
/** PORT LOCAL SRC */
p_my_task->loc_port_src = port_src;
/** PORT LOCAL DEST */
p_my_task->loc_port_dest = port_dest;
/** TIME */
__po_hi_time_t time;
int gettime = __po_hi_get_time (&time);
if (gettime == __PO_HI_SUCCESS){
p_my_task->mytime = time;
}
else{
printf("Can't get the time, break");
return __PO_HI_UNAVAILABLE;
}
/** REQUEST */
p_my_task->p_request = malloc (sizeof(__po_hi_request_t));
if (p_req != NULL){
memcpy(p_my_task->p_request, p_req, sizeof(__po_hi_request_t));
}
/** LOCKING THE MUTEX */
printf("lock");
__po_hi_mutex_lock (&__po_hi_c_trace_mutex);
printf("locked");
/** IF the log array is complete */
if (nb_struct >= 10){
/* A stream is opened */
printf("open");
history = fopen("history.txt", "a+" );
if (history == NULL){
printf("no history file is opened or created");
return __PO_HI_INVALID;
}
printf("close");
fseek(history, 0, SEEK_END);
/* The copying is done */
for (int i = 0; i < 10; i++){
fprintf(history,"event = %d; age_status = %d; task_id = %d; port_src_id = %d; port_dest_id = %d; local_port_src_id = %d; dest_src_id = %d; time : sec = %d, nsec = %d", task_log[i].event, task_log[i].status, task_log[i].task_id, task_log[i].global_port_src, task_log[i].global_port_dest, task_log[i].loc_port_src, task_log[i].loc_port_dest, (task_log[i].mytime).sec, (task_log[i].mytime).nsec);
fprintf(history, ", request = ");
fwrite(task_log[i].p_request,sizeof(__po_hi_request_t),1,history);
fprintf(history, "\n");
}
/* The index is returned back to 0 */
nb_struct = 0;
/* The stream is closed */
fclose(history);
}
/** If the log array isn't complete, write in it */
if (nb_struct < 10){
task_log[nb_struct] = my_task;
nb_struct += 1;
}
/** UNLOCKING THE MUTEX */
__po_hi_mutex_unlock (&__po_hi_c_trace_mutex);
return __PO_HI_SUCCESS;
}
......@@ -43,7 +43,7 @@
#endif
#if defined (MONITORING) /* Headers from run-time verification */
#include <trace_manager.hh>
#include <trace_manager.h>
#endif
#define __PO_HI_GQUEUE_OUT_PORT constant_out_identifier
......@@ -167,6 +167,12 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id,
ptr = &__po_hi_gqueues_most_recent_values[id][port];
memcpy (ptr, request, sizeof (__po_hi_request_t));
__PO_HI_DEBUG_DEBUG ("__po_hi_gqueue_store_out() from task %d on port %d\n", id, port);
#if defined (MONITORING)
printf("record_event");
record_event(ANY, STORE_OUT, id, invalid_port_t, invalid_port_t, port, invalid_local_port_t, request);
#endif
}
__po_hi_port_id_t __po_hi_gqueue_store_in (__po_hi_task_id id,
......@@ -268,7 +274,12 @@ void __po_hi_gqueue_wait_for_incoming_event (__po_hi_task_id id,
*port = __po_hi_gqueues_global_history[id][__po_hi_gqueues_global_history_offset[id]];
/* Releasing only the mutex of the semaphore*/
#if defined (MONITORING)
printf("record_event");
record_event(SPORADIC, WAIT_FOR, id, invalid_port_t, invalid_port_t, *port, invalid_local_port_t, NULL);
/** Releasing only the mutex of the semaphore*/
int res = __po_hi_sem_mutex_release_gqueue(__po_hi_gqueues_semaphores,id);
__DEBUGMSG("GQUEUE_SEM_MTUEX_RELEASE %d %d\n", id, res);
assert(res == __PO_HI_SUCCESS);
......@@ -326,7 +337,8 @@ int __po_hi_gqueue_get_value (__po_hi_task_id id,
}
#if defined (MONITORING)
update_sporadic_dispatch (id, port);
printf("record_event");
record_event(ANY, GET_VALUE, id, invalid_port_t, invalid_port_t, port, invalid_local_port_t , request);
#endif
if (__po_hi_gqueues_used_size[id][port] == 0)
......
......@@ -290,7 +290,9 @@ int __po_hi_initialize ()
/*!
* Initialize the monitoring trace if needed
*/
printf("soon monitoring\n ");
#if defined (MONITORING)
printf("trace_init");
trace_initialize ();
#endif
......
......@@ -701,7 +701,6 @@ int __po_hi_create_periodic_task (const __po_hi_task_id id,
*/
#if defined (MONITORING)
//__DEBUGMSG ("Periodic_task_creation\n");
record_event(PERIODIC, CREATION, id, invalid_port_t, invalid_port_t, invalid_local_port_t, invalid_local_port_t, NULL);
#endif
......@@ -756,7 +755,6 @@ int __po_hi_create_sporadic_task (const __po_hi_task_id id,
*/
#if defined (MONITORING)
//__DEBUGMSG ("Sporadic_task_creation\n");
record_event(SPORADIC, CREATION, id, invalid_port_t, invalid_port_t, invalid_local_port_t, invalid_local_port_t, NULL);
#endif
......
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