Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A commit before a design modification. I'm gonna try the weird
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Nov 2004 19:11:50 +0000 (19:11 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 24 Nov 2004 19:11:50 +0000 (19:11 +0000)
[ 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
src/surf/cpu_private.h
src/surf/surf.c
src/surf/trace_mgr.c

index ab00d8b..06b7eaa 100644 (file)
@@ -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<min) min=value;
index d802ccb..d10fea1 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef _SURF_CPU_PRIVATE_H
 #define _SURF_CPU_PRIVATE_H
 
-#include "surf/surf_private.h"
+#include "surf_private.h"
 
 typedef struct surf_action_cpu {
   s_surf_action_t generic_action;
index 6a7abaa..eeff674 100644 (file)
@@ -68,6 +68,16 @@ xbt_heap_float_t surf_solve(void)
   surf_resource_t resource = NULL;
   int i;
 
+  while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
+    if(next_event_date > 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_end<min)) 
index 0fc4fe7..0711849 100644 (file)
@@ -101,8 +101,8 @@ tmgr_trace_t tmgr_trace_new(const char *filename)
     last_event = xbt_dynar_get_ptr(trace->event_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) {