]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blobdiff - frsh_debug_and_trace.h
Added Makefiles for OMK makesystem
[frescor/frsh-include.git] / frsh_debug_and_trace.h
index ad03ff431c832c4d191679bd689656d12dd35c31..162c07f7e9cce9c79487be2b32a2d59789529fad 100644 (file)
 #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
@@ -96,6 +98,8 @@
 #define FRSH_TRACE_THREAD_INDEX false
 #define FRSH_TRACE_VRES_INDEX false
 
+#define FRSH_TRACE_DISTRIBUTED false
+
 /**
  * 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,28 +126,27 @@ 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;
 }
 
-
 /**
  * FRSH_TRACE()
  *
@@ -154,8 +155,10 @@ static inline long int FRSH_TIMESPEC_TO_RELATIVE_MSECS(const struct timespec *ts
  * program.
  *
  * Due to the "..." argument passing, this function cannot be
- * inlined. 
+ * inlined.
  **/
 void FRSH_TRACE(bool is_active, const char *format, ...);
 
+FRSH_CPP_END_DECLS
+
 #endif