- /* SD_task_watch(taskA, SD_SCHEDULED);
- SD_task_watch(taskA, SD_DONE);
- SD_task_unwatch(taskA, SD_SCHEDULED);
- SD_task_watch(taskA, SD_DONE);
- SD_task_watch(taskA, SD_SCHEDULED);*/
-
- SD_task_watch(taskA, SD_SCHEDULED);
-
- /* let's launch the simulation! */
-
- int workstation_number = 2;
- SD_workstation_t *workstation_list = SD_workstation_get_list();
- double computation_amount[] = {100, 200};
- double communication_amount[] =
- {
- 0, 30,
- 20, 0
- };
- double rate = 1;
-
- /* printf("Scheduling task A (state = %d)...\n", SD_task_get_state(taskA));*/
- SD_task_schedule(taskA, workstation_number, workstation_list,
- computation_amount, communication_amount, rate);
- /* printf("Done. Task A state: %d\n", SD_task_get_state(taskA));*/
-
- printf("Launching simulation...\n");
- SD_simulate(100);
+ SD_task_watch(taskD, SD_DONE);
+ SD_task_watch(taskB, SD_DONE);
+ SD_task_unwatch(taskD, SD_DONE);
+
+
+ /* scheduling parameters */
+ {
+ const int workstation_number = 2;
+ const SD_workstation_t workstation_list[] = {w1, w2};
+ double computation_amount[] = {computation_amount1, computation_amount2};
+ double communication_amount[] =
+ {
+ 0, communication_amount12,
+ communication_amount21, 0
+ };
+ SD_task_t *changed_tasks;
+ double rate = -1.0;
+
+ /* estimated time */
+ SD_task_t task = taskD;
+ INFO2("Estimated time for '%s': %f", SD_task_get_name(task),
+ SD_task_get_execution_time(task, workstation_number, workstation_list,
+ computation_amount, communication_amount, rate));
+
+ /* let's launch the simulation! */
+
+ SD_task_schedule(taskA, workstation_number, workstation_list,
+ computation_amount, communication_amount, rate);
+ SD_task_schedule(taskB, workstation_number, workstation_list,
+ computation_amount, communication_amount, rate);
+ SD_task_schedule(taskC, workstation_number, workstation_list,
+ computation_amount, communication_amount, rate);
+ SD_task_schedule(taskD, workstation_number, workstation_list,
+ computation_amount, communication_amount, rate);
+
+ changed_tasks = SD_simulate(-1.0);
+ xbt_assert0(changed_tasks[0] == taskD &&
+ changed_tasks[1] == taskB &&
+ changed_tasks[2] == taskC &&
+ changed_tasks[3] == NULL,
+ "Unexpected simulation results");
+
+ xbt_free(changed_tasks);
+ }
+ DEBUG0("Destroying tasks...");