X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/25f6494903ca6f70ce4408574a7e57e7419d427a..24b8008bb424160e633b1374f54dcd89bdcb9749:/src/surf/trace_mgr.c diff --git a/src/surf/trace_mgr.c b/src/surf/trace_mgr.c index 071184935c..c7a78a0c66 100644 --- a/src/surf/trace_mgr.c +++ b/src/surf/trace_mgr.c @@ -129,9 +129,9 @@ void tmgr_trace_free(tmgr_trace_t trace) xbt_free(trace); } -void tmgr_history_add_trace(tmgr_history_t history, tmgr_trace_t trace, - xbt_heap_float_t start_time, int offset, - void *resource) +tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t history, tmgr_trace_t trace, + xbt_heap_float_t start_time, int offset, + void *resource) { tmgr_trace_event_t trace_event = NULL; @@ -145,6 +145,8 @@ void tmgr_history_add_trace(tmgr_history_t history, tmgr_trace_t trace, abort(); xbt_heap_push(history->heap, trace_event, start_time); + + return trace_event; } xbt_heap_float_t tmgr_history_next_date(tmgr_history_t history) @@ -155,10 +157,10 @@ xbt_heap_float_t tmgr_history_next_date(tmgr_history_t history) return -1.0; } -int tmgr_history_get_next_event_leq(tmgr_history_t history, - xbt_heap_float_t date, - xbt_maxmin_float_t * value, - void **resource) +tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t history, + xbt_heap_float_t date, + xbt_maxmin_float_t * value, + void **resource) { xbt_heap_float_t event_date = xbt_heap_maxkey(history->heap); tmgr_trace_event_t trace_event = NULL; @@ -166,10 +168,10 @@ int tmgr_history_get_next_event_leq(tmgr_history_t history, tmgr_trace_t trace = NULL; if (event_date > date) - return 0; + return NULL; if (!(trace_event = xbt_heap_pop(history->heap))) - return 0; + return NULL; trace = trace_event->trace; event = xbt_dynar_get_ptr(trace->event_list, trace_event->idx); @@ -188,5 +190,10 @@ int tmgr_history_get_next_event_leq(tmgr_history_t history, xbt_free(trace_event); } - return 1; + return trace_event; +} + +void tmgr_finalize(void) +{ + xbt_dict_free(&trace_list); }