From e1d9c1d28c6bbf8c0ad26b067f8a67a5a36a7f63 Mon Sep 17 00:00:00 2001 From: schnorr Date: Wed, 29 Dec 2010 11:38:03 +0000 Subject: [PATCH] [trace] only CPU models control the last timestamp to be dumped to trace file details: - for CPU model Cas01_fullupdate, it is safe to set TRACE_last_timestamp_to_dump to now-delta - for CPU model Cas01, the last timestamp to be dumped must be equal to the smaller cpu->last_update among all cpu resources - for now, network models depend on cpu models to dump their events => if a simulator is configured to have only a network model, without an instrumented cpu model (or without a cpu model at all), the dump will occur only in the end of simulation. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9331 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/surf/cpu.c | 1 + src/surf/cpu_im.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 4a56bfc75e..b977e50c84 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -214,6 +214,7 @@ static void cpu_update_actions_state(double now, double delta) lmm_variable_getvalue (action->variable), now - delta, delta); + TRACE_last_timestamp_to_dump = now-delta; #endif double_update(&(action->generic_action.remains), lmm_variable_getvalue(action->variable) * delta); diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index 093b626ae3..e2680c1184 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -345,6 +345,28 @@ static void cpu_im_update_actions_state(double now, double delta) cpu_im_cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE); cpu_im_update_remains(action->cpu, surf_get_clock()); } +#ifdef HAVE_TRACING + { + //defining the last timestamp that we can safely dump to trace file + //without losing the event ascending order (considering all CPU's) + cpu_Cas01_im_t cpu; + xbt_dict_cursor_t cursor; + char *key; + double smaller = -1; + xbt_dict_foreach(surf_model_resource_set(surf_cpu_model), cursor, key, cpu){ + if (smaller < 0){ + smaller = cpu->last_update; + continue; + } + if (cpu->last_update < smaller){ + smaller = cpu->last_update; + } + } + if (smaller > 0) { + TRACE_last_timestamp_to_dump = smaller; + } + } +#endif return; } -- 2.20.1