Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use new style logging macros.
[simgrid.git] / src / surf / trace_mgr.c
index fefbc2a..dea5183 100644 (file)
@@ -1,6 +1,5 @@
-/*     $Id$     */
-
-/* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                  */
+/* Copyright (c) 2004, 2005, 2007, 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -16,7 +15,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_trace, surf, "Surf trace management");
 
 static xbt_dict_t trace_list = NULL;
 
-tmgr_history_t tmgr_history_new(void)
+XBT_INLINE tmgr_history_t tmgr_history_new(void)
 {
   tmgr_history_t h;
 
@@ -27,7 +26,7 @@ tmgr_history_t tmgr_history_new(void)
   return h;
 }
 
-void tmgr_history_free(tmgr_history_t h)
+XBT_INLINE void tmgr_history_free(tmgr_history_t h)
 {
   xbt_heap_free(h->heap);
   free(h);
@@ -47,7 +46,7 @@ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input,
   if (trace_list) {
     trace = xbt_dict_get_or_null(trace_list, id);
     if (trace) {
-      WARN1("Ignoring redefinition of trace %s", id);
+      XBT_WARN("Ignoring redefinition of trace %s", id);
       return trace;
     }
   }
@@ -83,8 +82,8 @@ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input,
     }
     xbt_dynar_push(trace->event_list, &event);
     last_event =
-      xbt_dynar_get_ptr(trace->event_list,
-                        xbt_dynar_length(trace->event_list) - 1);
+        xbt_dynar_get_ptr(trace->event_list,
+                          xbt_dynar_length(trace->event_list) - 1);
   }
   if (last_event)
     last_event->delta = periodicity;
@@ -101,6 +100,7 @@ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input,
 
 tmgr_trace_t tmgr_trace_new(const char *filename)
 {
+  char *tstr = NULL;
   FILE *f = NULL;
   tmgr_trace_t trace = NULL;
 
@@ -110,16 +110,16 @@ tmgr_trace_t tmgr_trace_new(const char *filename)
   if (trace_list) {
     trace = xbt_dict_get_or_null(trace_list, filename);
     if (trace) {
-      WARN1("Ignoring redefinition of trace %s", filename);
+      XBT_WARN("Ignoring redefinition of trace %s", filename);
       return trace;
     }
   }
 
   f = surf_fopen(filename, "r");
-  xbt_assert2(f!=NULL, "Cannot open file '%s' (path=%s)", filename,
-       xbt_str_join(surf_path,":"));
+  xbt_assert2(f != NULL, "Cannot open file '%s' (path=%s)", filename,
+              xbt_str_join(surf_path, ":"));
 
-  char *tstr = xbt_str_from_file(f);
+  tstr = xbt_str_from_file(f);
   fclose(f);
   trace = tmgr_trace_new_from_string(filename, tstr, 0.);
   xbt_free(tstr);
@@ -142,7 +142,7 @@ tmgr_trace_t tmgr_empty_trace_new(void)
   return trace;
 }
 
-void tmgr_trace_free(tmgr_trace_t trace)
+XBT_INLINE void tmgr_trace_free(tmgr_trace_t trace)
 {
   if (!trace)
     return;
@@ -170,7 +170,7 @@ tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h,
   return trace_event;
 }
 
-double tmgr_history_next_date(tmgr_history_t h)
+XBT_INLINE double tmgr_history_next_date(tmgr_history_t h)
 {
   if (xbt_heap_size(h->heap))
     return (xbt_heap_maxkey(h->heap));
@@ -213,7 +213,7 @@ tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h,
   return trace_event;
 }
 
-void tmgr_finalize(void)
+XBT_INLINE void tmgr_finalize(void)
 {
   xbt_dict_free(&trace_list);
 }