A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Enforce some order on the tags; needs flexml 1.8 to get relevant error messages when...
[simgrid.git]
/
src
/
surf
/
trace_mgr.c
diff --git
a/src/surf/trace_mgr.c
b/src/surf/trace_mgr.c
index
b61bac0
..
a00896d
100644
(file)
--- a/
src/surf/trace_mgr.c
+++ b/
src/surf/trace_mgr.c
@@
-6,14
+6,10
@@
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "xbt/sysdep.h"
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "xbt/sysdep.h"
-#include "xbt/
error
.h"
+#include "xbt/
log
.h"
#include "xbt/dict.h"
#include "trace_mgr_private.h"
#include "surf_private.h"
#include "xbt/dict.h"
#include "trace_mgr_private.h"
#include "surf_private.h"
-#include <stdlib.h>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(trace, surf,
- "Logging specific to the SURF trace module");
static xbt_dict_t trace_list = NULL;
static void _tmgr_trace_free(void *trace)
static xbt_dict_t trace_list = NULL;
static void _tmgr_trace_free(void *trace)
@@
-27,7
+23,7
@@
tmgr_history_t tmgr_history_new(void)
h = xbt_new0(s_tmgr_history_t, 1);
h = xbt_new0(s_tmgr_history_t, 1);
- h->heap = xbt_heap_new(8,
free);
/* Why 8 ? Well, why not... */
+ h->heap = xbt_heap_new(8,
xbt_free_f);
/* Why 8 ? Well, why not... */
return h;
}
return h;
}
@@
-49,7
+45,7
@@
tmgr_trace_t tmgr_trace_new(const char *filename)
tmgr_event_t last_event = NULL;
if (trace_list) {
tmgr_event_t last_event = NULL;
if (trace_list) {
-
xbt_dict_get(trace_list, filename, (void **) &trac
e);
+
trace = xbt_dict_get_or_null(trace_list, filenam
e);
if (trace)
return trace;
}
if (trace)
return trace;
}
@@
-112,9
+108,9
@@
tmgr_trace_t tmgr_trace_new(const char *filename)
tmgr_trace_t tmgr_empty_trace_new(void)
{
tmgr_trace_t trace = NULL;
tmgr_trace_t tmgr_empty_trace_new(void)
{
tmgr_trace_t trace = NULL;
- double periodicity = -1.0; /* No periodicity by default */
+ /*double periodicity = -1.0; No periodicity by default; unused variables
+ tmgr_event_t last_event = NULL; */
s_tmgr_event_t event;
s_tmgr_event_t event;
- tmgr_event_t last_event = NULL;
trace = xbt_new0(s_tmgr_trace_t, 1);
trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);
trace = xbt_new0(s_tmgr_trace_t, 1);
trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);
@@
-137,15
+133,14
@@
void tmgr_trace_free(tmgr_trace_t trace)
tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h,
tmgr_trace_t trace,
double start_time, int offset,
tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h,
tmgr_trace_t trace,
double start_time, int offset,
- void *
resource
)
+ void *
model
)
{
tmgr_trace_event_t trace_event = NULL;
{
tmgr_trace_event_t trace_event = NULL;
-
trace_event = xbt_new0(s_tmgr_trace_event_t, 1);
trace_event->trace = trace;
trace_event->idx = offset;
trace_event = xbt_new0(s_tmgr_trace_event_t, 1);
trace_event->trace = trace;
trace_event->idx = offset;
- trace_event->
resource = resource
;
+ trace_event->
model = model
;
xbt_assert0((trace_event->idx < xbt_dynar_length(trace->event_list)),
"You're refering to an event that does not exist!");
xbt_assert0((trace_event->idx < xbt_dynar_length(trace->event_list)),
"You're refering to an event that does not exist!");
@@
-166,9
+161,9
@@
double tmgr_history_next_date(tmgr_history_t h)
tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h,
double date,
double *value,
tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h,
double date,
double *value,
- void **
resource
)
+ void **
model
)
{
{
- double event_date =
xbt_heap_maxkey(h->heap
);
+ double event_date =
tmgr_history_next_date(h
);
tmgr_trace_event_t trace_event = NULL;
tmgr_event_t event = NULL;
tmgr_trace_t trace = NULL;
tmgr_trace_event_t trace_event = NULL;
tmgr_event_t event = NULL;
tmgr_trace_t trace = NULL;
@@
-182,9
+177,8
@@
tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h,
trace = trace_event->trace;
event = xbt_dynar_get_ptr(trace->event_list, trace_event->idx);
trace = trace_event->trace;
event = xbt_dynar_get_ptr(trace->event_list, trace_event->idx);
-
*value = event->value;
*value = event->value;
- *
resource = trace_event->resource
;
+ *
model = trace_event->model
;
if (trace_event->idx < xbt_dynar_length(trace->event_list) - 1) {
xbt_heap_push(h->heap, trace_event, event_date + event->delta);
if (trace_event->idx < xbt_dynar_length(trace->event_list) - 1) {
xbt_heap_push(h->heap, trace_event, event_date + event->delta);
@@
-194,6
+188,7
@@
tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h,
trace_event->idx = 0;
} else { /* We don't need this trace_event anymore */
free(trace_event);
trace_event->idx = 0;
} else { /* We don't need this trace_event anymore */
free(trace_event);
+ return NULL;
}
return trace_event;
}
return trace_event;