]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blobdiff - frsh_debug_and_trace.h
Update transaction API
[frescor/frsh-include.git] / frsh_debug_and_trace.h
index d86fd39116b4acb1c14eb869f1abdb76901edcc6..54af6aa8d924d3903e590e278d80150cce7222e4 100644 (file)
@@ -1,5 +1,5 @@
 // -----------------------------------------------------------------------
-//  Copyright (C) 2006 - 2007 FRESCOR consortium partners:
+//  Copyright (C) 2006 - 2009 FRESCOR consortium partners:
 //
 //    Universidad de Cantabria,              SPAIN
 //    University of York,                    UK
 //   FSF API web pages: http://marte.unican.es/fsf/docs
 //                      http://shark.sssup.it/contrib/first/docs/
 //
-//  This file is part of FRSH Implementation
+//   This file is part of FRSH (FRescor ScHeduler)
 //
-//  FRSH API is free software; you can  redistribute it and/or  modify
-//  it under the terms of  the GNU General Public License as published by
-//  the Free Software Foundation;  either  version 2, or (at  your option)
-//  any later version.
+//  FRSH is free software; you can redistribute it and/or modify it
+//  under terms of the GNU General Public License as published by the
+//  Free Software Foundation; either version 2, or (at your option) any
+//  later version.  FRSH is distributed in the hope that it will be
+//  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+//  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//  General Public License for more details. You should have received a
+//  copy of the GNU General Public License along with FRSH; see file
+//  COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+//  Cambridge, MA 02139, USA.
 //
-//  FRSH API  is distributed  in  the hope  that  it  will  be useful,  but
-//  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
-//  MERCHANTABILITY  or  FITNESS FOR  A  PARTICULAR PURPOSE. See  the  GNU
-//  General Public License for more details.
-//
-//  You should have  received a  copy of  the  GNU  General Public License
-//  distributed  with  FRSH API;  see file COPYING.   If not,  write to the
-//  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
-//  02111-1307, USA.
-//
-//  As a special exception, if you include this header file into source
-//  files to be compiled, this header file does not by itself cause
-//  the resulting executable to be covered by the GNU General Public
-//  License.  This exception does not however invalidate any other
-//  reasons why the executable file might be covered by the GNU General
-//  Public License.
+//  As a special exception, including FRSH header files in a file,
+//  instantiating FRSH generics or templates, or linking other files
+//  with FRSH objects to produce an executable application, does not
+//  by itself cause the resulting executable application to be covered
+//  by the GNU General Public License. This exception does not
+//  however invalidate any other reasons why the executable file might be
+//  covered by the GNU Public License.
 // -----------------------------------------------------------------------
 //==============================================
 //  ******** *******    ********  **      **
 #include <stdio.h> // for vprintf
 #include <stdbool.h> // for bool
 #include <stdarg.h> // for va_list, va_start and va_end
+#include "fosa.h"
 #include "frsh_debug_and_trace_types.h"
-#include "timespec_operations.h"
 #include "fosa_configuration_parameters.h" /* FOSA_CLOCK_REALTIME */
 #include "fosa_clocks_and_timers.h"
 
+FRSH_CPP_BEGIN_DECLS
+
 // Tune the following FLAGS to select the debugging messages to be generated
 #define FRSH_TRACE_CALLBACKS false
 #define FRSH_TRACE_SERVICE_TH false
 #define FRSH_TRACE_WATCHDOG false
 #define FRSH_TRACE_SPORADIC_SERVER false
+#define FRSH_TRACE_REPLENISHMENTS false
 #define FRSH_TRACE_ROUND_ROBIN false
 #define FRSH_TRACE_BOUNDED_JOB false
-
+#define FRSH_TRACE_SYNCHRONIZE_WORKLOAD false
 #define FRSH_TRACE_ADMISSION_TEST false
 #define FRSH_TRACE_ADMISSION_RESULT false
 
 #define FRSH_TRACE_THREAD_INDEX false
 #define FRSH_TRACE_VRES_INDEX false
 
+#define FRSH_TRACE_DISTRIBUTED false
+
+#define QUICK_AND_DIRTY_FIX_JLDEMO true
+
+
 /**
  * frsh_trace_point_insert()
  *
  */
 int frsh_trace_point_insert(frsh_trace_point_id_t ipoint);
 
-#define FRSH_TRACE_DISTRIBUTED false
-
 /** If FRSH_TRACE_TS_MSECS is defined, each trace line is prefixed
     with a msec counter **/
 #define FRSH_TRACE_TS_MSECS
 
 /* These variables live defined in frsh_error.c */
 /************************************************/
-extern struct timespec frsh_trace_init_timespec;
+extern fosa_abs_time_t frsh_trace_init_timespec;
 extern long frsh_trace_init_timemsec;
 
 extern int global_error_condition;  /* Used to propagate error
@@ -124,45 +127,39 @@ extern int global_error_condition;  /* Used to propagate error
 static inline long int FRSH_GET_TIMESTAMP_MSECS()
 {
     int terror = -1;
-    struct timespec current_time = {-1, -1};
+    fosa_abs_time_t current_time;
     long int current_time_msec = -1;
     long int result = -1;
 
     PRW(  fosa_clock_get_time(FOSA_CLOCK_REALTIME, &current_time)  );
-    current_time_msec = timespec2msec(&current_time);
+    current_time_msec = fosa_abs_time_to_msec(current_time);
 
     result = current_time_msec - frsh_trace_init_timemsec;
 
     return result;
 }
 
-static inline long int FRSH_TIMESPEC_TO_RELATIVE_MSECS(const struct timespec *tspec)
+static inline long int FRSH_TIMESTAMP_TO_RELATIVE_MSECS(const fosa_abs_time_t *timestamp)
 {
     long int time_msecs = -1;
 
-    time_msecs = timespec2msec(tspec);
+    time_msecs = fosa_abs_time_to_msec(*timestamp);
 
     return time_msecs - frsh_trace_init_timemsec;
 }
 
-static void inline FRSH_TRACE(bool is_active, const char *format, ...)
-{
-    va_list args;
-
-#ifdef FRSH_TRACE_TS_MSECS
-    const int TS_LENGTH_MSECS = 10; /* Room for LONG_MAX 2147483648 */
-#endif
-
-    if (is_active) {
-
-        va_start(args, format);
+/**
+ * FRSH_TRACE()
+ *
+ * If the boolean value is true, print the format line optionally
+ * preceded by a timestamp in ms relative to the start of the
+ * program.
+ *
+ * Due to the "..." argument passing, this function cannot be
+ * inlined.
+ **/
+void FRSH_TRACE(bool is_active, const char *format, ...);
 
-#ifdef FRSH_TRACE_TS_MSECS
-        printf("%*ld: ", TS_LENGTH_MSECS, FRSH_GET_TIMESTAMP_MSECS());
-#endif
-        vprintf(format, args);
-        va_end(args);
-    }
-}
+FRSH_CPP_END_DECLS
 
 #endif