From 25f6494903ca6f70ce4408574a7e57e7419d427a Mon Sep 17 00:00:00 2001 From: alegrand Date: Wed, 24 Nov 2004 19:11:50 +0000 Subject: [PATCH 1/1] A commit before a design modification. I'm gonna try the weird [ A ][ B ][ C ] structure I've talking you about. If it does not work or is a way to dirty I'll revert later. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@524 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/surf/cpu.c | 12 +++++++++--- src/surf/cpu_private.h | 2 +- src/surf/surf.c | 10 ++++++++++ src/surf/trace_mgr.c | 4 ++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/surf/cpu.c b/src/surf/cpu.c index ab00d8bf2e..06b7eaa4d1 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -27,8 +27,12 @@ static void *new_cpu(const char *name, xbt_maxmin_float_t power_scale, cpu->power_scale = power_scale; cpu->current_power = initial_power; cpu->power_trace = power_trace; + if(power_trace) tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu); + cpu->current_state = initial_state; cpu->state_trace = state_trace; + if(state_trace) tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu); + cpu->constraint = lmm_constraint_new(sys, cpu, cpu->current_power * cpu->power_scale); xbt_dict_set(cpu_set, name, cpu, NULL); @@ -38,8 +42,11 @@ static void *new_cpu(const char *name, xbt_maxmin_float_t power_scale, static void parse_file(const char *file) { - new_cpu("Cpu A", 20.0, 1.0, NULL, SURF_CPU_ON, NULL); - new_cpu("Cpu B", 120.0, 1.0, NULL, SURF_CPU_ON, NULL); + tmgr_trace_t trace_A = tmgr_trace_new("trace_A.txt"); + tmgr_trace_t trace_B = tmgr_trace_new("trace_B.txt"); + + new_cpu("Cpu A", 20.0, 1.0, trace_A, SURF_CPU_ON, NULL); + new_cpu("Cpu B", 120.0, 1.0, trace_B, SURF_CPU_ON, NULL); } static void *name_service(const char *name) @@ -106,7 +113,6 @@ static xbt_heap_float_t share_resources() min = action->generic_action.remains / value ; xbt_swag_foreach(action,running_actions) { - /* If everything is stable... */ value = action->generic_action.remains / lmm_variable_getvalue(action->variable); if(value NOW) break; + while (tmgr_history_get_next_event_leq(history, next_event_date, + &value, (void **) &resource)) { + if(surf_cpu_resource->resource.resource_used(resource)) { + min = next_event_date-NOW; + } + } + } + xbt_dynar_foreach (resource_list,i,resource) { resource_next_action_end = resource->share_resources(NOW); if((min<0) || (resource_next_action_endevent_list, xbt_dynar_length(trace->event_list) - 1); - printf(XBT_HEAP_FLOAT_T " " XBT_MAXMIN_FLOAT_T "\n", event.delta, - event.value); +/* printf(XBT_HEAP_FLOAT_T " " XBT_MAXMIN_FLOAT_T "\n", event.delta, */ +/* event.value); */ } if (periodicity > 0) { -- 2.20.1