Browse Source

add func to update the elapsed flops

Andra Hugo 11 years ago
parent
commit
d010c07b4a
2 changed files with 15 additions and 0 deletions
  1. 3 0
      sc_hypervisor/include/sc_hypervisor.h
  2. 12 0
      sc_hypervisor/src/sc_hypervisor.c

+ 3 - 0
sc_hypervisor/include/sc_hypervisor.h

@@ -131,6 +131,9 @@ void sc_hypervisor_set_type_of_task(struct starpu_codelet *cl, unsigned sched_ct
 /* change dynamically the total number of flops of a context, move the deadline of the finishing time of the context */
 void sc_hypervisor_update_diff_total_flops(unsigned sched_ctx, double diff_total_flops);
 
+/* change dynamically the number of the elapsed flops in a context, modify the past in order to better compute the speed */
+void sc_hypervisor_update_diff_elapsed_flops(unsigned sched_ctx, double diff_task_flops);
+
 #ifdef __cplusplus
 }
 #endif

+ 12 - 0
sc_hypervisor/src/sc_hypervisor.c

@@ -998,3 +998,15 @@ void sc_hypervisor_update_diff_total_flops(unsigned sched_ctx, double diff_total
 /* 	       hypervisor.sched_ctx_w[sched_ctx].total_flops, hypervisor.sched_ctx_w[sched_ctx].remaining_flops, sched_ctx); */
 	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 }
+
+void sc_hypervisor_update_diff_elapsed_flops(unsigned sched_ctx, double diff_elapsed_flops)
+{
+	int workerid = starpu_worker_get_id();
+	if(workerid != -1)
+	{
+		starpu_pthread_mutex_lock(&act_hypervisor_mutex);
+		hypervisor.sched_ctx_w[sched_ctx].elapsed_flops[workerid] += diff_elapsed_flops;
+		hypervisor.sched_ctx_w[sched_ctx].total_elapsed_flops[workerid] += diff_elapsed_flops;
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
+	}
+}