Commit dcd84200 authored by julien.delange's avatar julien.delange
Browse files

* src/po_hi_gqueue.c

   - Remove useless informations when debug is not active

 * src/po_hi_transport.c
   - Remove useless informations when debug is not active

 * include/po_hi_debug.h
   - Defines new mechanisms to print debug information

 * configure.ac
   - Define the new 4 debug levels mechanisms




git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@1646 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent c4fc17f7
......@@ -76,8 +76,26 @@ AM_PATH_OCARINA(1.1, ,AC_MSG_ERROR([Ocarina 1.1 or later is not installed on you
r system]))
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on debugging options],
[ AC_DEFINE([__PO_HI_DEBUG], [], ["Enable debug options for PolyORB-HI-C"])])
[ --enable-debug[=level] specify debugging level.
Values are:
* critical - runtime errors that will imply a failure
* warning - runtime errors that do not crash the system
* debug - useful for debugging purpose
* info - ALL informations about the system],
[ case ${enableval} in
info)
AC_DEFINE_UNQUOTED(__PO_HI_DEBUG_LEVEL, 10, "Debug level - show ALL potential informations.")
;;
debug)
AC_DEFINE_UNQUOTED(__PO_HI_DEBUG_LEVEL, 6, "Warning - information that can show errors but are not so important")
;;
warning)
AC_DEFINE_UNQUOTED(__PO_HI_DEBUG_LEVEL, 4, "Critical - Errors that will imply a fault or a crash")
;;
*)
AC_DEFINE_UNQUOTED(__PO_HI_DEBUG_LEVEL, 0, "None - Do not print anything")
;;
esac])
AC_ARG_ENABLE(giop,
[ --enable-giop Use the GIOP protocol],
......
......@@ -14,11 +14,47 @@
#include <po_hi_config.h>
#include <po_hi_time.h>
#ifdef __PO_HI_DEBUG
#include <stdio.h>
#define __DEBUGMSG(s, args...) fprintf(stderr, s, ##args); fflush (stderr);
#define __PO_HI_DEBUG_LEVEL_INFO 12
#define __PO_HI_DEBUG_LEVEL_DEBUG 10
#define __PO_HI_DEBUG_LEVEL_WARNING 6
#define __PO_HI_DEBUG_LEVEL_CRITICAL 4
#define __PO_HI_DEBUG_LEVEL_NONE 0
#ifndef __PO_HI_DEBUG_LEVEL
#define __PO_HI_DEBUG_LEVEL __PO_HI_DEBUG_LEVEL_NONE
#endif
#if __PO_HI_DEBUG_LEVEL > __PO_HI_DEBUG_LEVEL_NONE
#include <stdio.h>
#endif
#if __PO_HI_DEBUG_LEVEL >= __PO_HI_DEBUG_LEVEL_CRITICAL
#define __PO_HI_DEBUG_CRITICAL(s, args...) fprintf(stderr, s, ##args); fflush (stderr);
#else
#define __DEBUGMSG(s, args...)
#define __PO_HI_DEBUG_CRITICAL(s, args...)
#endif
#if __PO_HI_DEBUG_LEVEL >= __PO_HI_DEBUG_LEVEL_WARNING
#define __PO_HI_DEBUG_WARNING(s, args...) fprintf(stderr, s, ##args); fflush (stderr);
#else
#define __PO_HI_DEBUG_WARNING(s, args...)
#endif
#if __PO_HI_DEBUG_LEVEL >= __PO_HI_DEBUG_LEVEL_DEBUG
#define __PO_HI_DEBUG_DEBUG(s, args...) fprintf(stderr, s, ##args); fflush (stderr);
#else
#define __PO_HI_DEBUG_DEBUG(s, args...)
#endif
#if __PO_HI_DEBUG_LEVEL >= __PO_HI_DEBUG_LEVEL_INFO
#define __PO_HI_DEBUG_INFO(s, args...) fprintf(stderr, s, ##args); fflush (stderr);
#define __DEBUGMSG(s, args...) fprintf(stderr, s, ##args); fflush (stderr);
#else
#define __PO_HI_DEBUG_INFO(s, args...)
#define __DEBUGMSG(s, args...)
#endif
#endif /* __DEBUG_H__ */
......@@ -128,18 +128,18 @@ void __po_hi_gqueue_init (__po_hi_task_id id,
#endif
#ifdef RTEMS_PURE
__DEBUGMSG ("[GQUEUE] Create semaphore for queue of task %d\n", id);
__PO_HI_DEBUG_INFO ("[GQUEUE] Create semaphore for queue of task %d\n", id);
ret = rtems_semaphore_create (rtems_build_name ('G', 'S', 'E' , 'A' + (char) id), 1, RTEMS_BINARY_SEMAPHORE, __PO_HI_DEFAULT_PRIORITY, &(__po_hi_gqueues_semaphores[id]));
if (ret != RTEMS_SUCCESSFUL)
{
__DEBUGMSG ("[GQUEUE] Cannot create semaphore, error code=%d\n", ret);
__PO_HI_DEBUG_WARNING ("[GQUEUE] Cannot create semaphore, error code=%d\n", ret);
}
__DEBUGMSG ("[GQUEUE] Create barrier for queue of task %d\n", id);
__PO_HI_DEBUG_INFO ("[GQUEUE] Create barrier for queue of task %d\n", id);
ret = rtems_barrier_create (rtems_build_name ('G', 'S', 'I' , 'A' + (char) id),RTEMS_BARRIER_AUTOMATIC_RELEASE , 10, &(__po_hi_gqueues_barriers[id]));
if (ret != RTEMS_SUCCESSFUL)
{
__DEBUGMSG ("[GQUEUE] Cannot create barrier, error code=%d\n", ret);
__PO_HI_DEBUG_WARNING ("[GQUEUE] Cannot create barrier, error code=%d\n", ret);
}
#endif
......@@ -187,7 +187,7 @@ void __po_hi_gqueue_store_out (__po_hi_task_id id,
request->port = __PO_HI_GQUEUE_OUT_PORT;
ptr = &__po_hi_gqueues_most_recent_values[id][port];
memcpy (ptr, request, sizeof (*request));
__DEBUGMSG ("__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);
}
......@@ -243,10 +243,10 @@ rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS];
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
__DEBUGMSG ("[GQUEUE] Cannot release semaphore in __po_hi_gqueue_store_in()\n");
__PO_HI_DEBUG_CRITICAL ("[GQUEUE] Cannot release semaphore in __po_hi_gqueue_store_in()\n");
}
#endif
__DEBUGMSG ("[GQUEUE] QUEUE FULL, task-id=%d, port=%d", id, port);
__PO_HI_DEBUG_CRITICAL ("[GQUEUE] QUEUE FULL, task-id=%d, port=%d", id, port);
return __PO_HI_ERROR_QUEUE_FULL;
}
......@@ -273,7 +273,7 @@ rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS];
ret = rtems_semaphore_release (__po_hi_gqueues_semaphores[id]);
if (ret != RTEMS_SUCCESSFUL)
{
__DEBUGMSG ("[GQUEUE] Cannot release semaphore in __po_hi_gqueue_store_in()\n");
__PO_HI_DEBUG_CRITICAL ("[GQUEUE] Cannot release semaphore in __po_hi_gqueue_store_in()\n");
}
#endif
......@@ -407,7 +407,7 @@ rtems_id __po_hi_gqueues_barriers[__PO_HI_NB_TASKS];
}
__DEBUGMSG ("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
......
......@@ -63,19 +63,15 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
if (request->port == -1)
{
#ifdef __PO_HI_DEBUG
__DEBUGMSG ("Send output task %d, port %d : no value to send\n", id, port);
#endif
__PO_HI_DEBUG_DEBUG ("Send output task %d, port %d : no value to send\n", id, port);
return __PO_HI_SUCCESS;
}
ndest = __po_hi_gqueue_get_destinations_number (id, local_port);
#ifdef __PO_HI_DEBUG
__DEBUGMSG ("Send value, emitter task %d, emitter port %d, emitter entity %d, destination ports :\n", id, port, __po_hi_port_global_to_entity[port]);
#endif
__PO_HI_DEBUG_DEBUG ("Send value, emitter task %d, emitter port %d, emitter entity %d, destination ports :\n", id, port, __po_hi_port_global_to_entity[port]);
#ifdef __PO_HI_DEBUG
#if __PO_HI_DEBUG_LEVEL >= __PO_HI_DEBUG_LEVEL_INFO
__DEBUGMSG ("SENT Value: |");
{
int s;
......@@ -97,11 +93,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
{
destination_port = __po_hi_gqueue_get_destination (id, local_port, i);
destination_entity = __po_hi_get_entity_from_global_port (destination_port);
#ifdef __PO_HI_DEBUG
__DEBUGMSG ("\t%d (entity=%d)",
destination_port,
destination_entity);
#endif
__PO_HI_DEBUG_DEBUG ("\t%d (entity=%d)", destination_port, destination_entity);
__po_hi_msg_reallocate (&msg);
request->port = destination_port;
......@@ -109,13 +101,13 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
if (__po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (port)) ==
__po_hi_transport_get_node_from_entity (__po_hi_get_entity_from_global_port (destination_port)))
{
__DEBUGMSG (" [deliver locally]\n");
__PO_HI_DEBUG_DEBUG (" [deliver locally]\n");
__po_hi_main_deliver (request);
}
#if defined (__PO_HI_NEED_DRIVER_SOCKETS) && (__PO_HI_NB_NODES > 1)
else
{
__DEBUGMSG (" [deliver using network sockets]");
__PO_HI_DEBUG_DEBUG (" [deliver using network sockets]");
__po_hi_marshall_request (request, &msg);
error =__po_hi_driver_sockets_send (__po_hi_port_global_to_entity[port],
......@@ -131,7 +123,7 @@ int __po_hi_transport_send_default (__po_hi_task_id id, __po_hi_port_t port)
request->port = __PO_HI_GQUEUE_INVALID_PORT;
#ifdef __PO_HI_DEBUG
__DEBUGMSG ("\n");
__PO_HI_DEBUG_DEBUG ("\n");
#endif
return __PO_HI_SUCCESS;
......
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