Browse Source

notify idleness at pop level in order to assign more pricesily idle time among contexts sharing a worker

Pierre-André Wacrenier 11 years ago
parent
commit
2f7b61d57f
1 changed files with 30 additions and 9 deletions
  1. 30 9
      src/core/sched_policy.c

+ 30 - 9
src/core/sched_policy.c

@@ -630,18 +630,28 @@ pick:
 				}
 				}
 			}
 			}
 
 
-			if(!task && sched_ctx && worker->removed_from_ctx[sched_ctx->id])
+			if(!task)
 			{
 			{
-				_starpu_worker_gets_out_of_ctx(sched_ctx->id, worker);
-				worker->removed_from_ctx[sched_ctx->id] = 0;
-			}
+				if(sched_ctx && worker->removed_from_ctx[sched_ctx->id])
+				{
+					_starpu_worker_gets_out_of_ctx(sched_ctx->id, worker);
+					worker->removed_from_ctx[sched_ctx->id] = 0;
+				} 
+#ifdef STARPU_USE_SC_HYPERVISOR
+				else 
+				{
+					struct starpu_sched_ctx_performance_counters *perf_counters = sched_ctx->perf_counters;
+					perf_counters->notify_idle_cycle(sched_ctx->id, worker->workerid, 1.0);
+				}
+#endif //STARPU_USE_SC_HYPERVISOR
+					
 #ifndef STARPU_NON_BLOCKING_DRIVERS
 #ifndef STARPU_NON_BLOCKING_DRIVERS
-			if((!task && sched_ctx->pop_counter[worker->workerid] == 0 && been_here[sched_ctx->id]) || worker->nsched_ctxs == 1)
-				break;
-
-
-			been_here[sched_ctx->id] = 1;
+				if((sched_ctx->pop_counter[worker->workerid] == 0 && been_here[sched_ctx->id]) || worker->nsched_ctxs == 1)
+					break;
+				been_here[sched_ctx->id] = 1;
 #endif
 #endif
+			}
+			
 			sched_ctx->pop_counter[worker->workerid]++;
 			sched_ctx->pop_counter[worker->workerid]++;
 		}
 		}
 	  }
 	  }
@@ -650,6 +660,17 @@ pick:
 	if (!task)
 	if (!task)
 		return NULL;
 		return NULL;
 
 
+
+
+#ifdef STARPU_USE_SC_HYPERVISOR
+	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(task->sched_ctx);
+	struct starpu_sched_ctx_performance_counters *perf_counters = sched_ctx->perf_counters;
+
+	if(sched_ctx->id != 0 && perf_counters != NULL && perf_counters->notify_idle_end)
+		perf_counters->notify_idle_end(task->sched_ctx, worker->workerid);
+#endif //STARPU_USE_SC_HYPERVISOR
+
+
 	/* Make sure we do not bother with all the multiformat-specific code if
 	/* Make sure we do not bother with all the multiformat-specific code if
 	 * it is not necessary. */
 	 * it is not necessary. */
 	if (!_starpu_task_uses_multiformat_handles(task))
 	if (!_starpu_task_uses_multiformat_handles(task))