> [ 0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds
> [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=1000.00 J
> [ 10.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
-> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1200 J
+> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1120 J
> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s)
> [ 11.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
-> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1950 J
+> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1645 J
> [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds
-> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2310 J
+> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2005 J
> [ 20.000000] (1:dvfs_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated 2000 J so far.
-> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=3210 J
+> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2905 J
> [ 30.000000] (0:maestro@) Total simulation time: 30.00
-> [ 30.000000] (0:maestro@) Total energy of host MyHost1: 3210.000000 Joules
+> [ 30.000000] (0:maestro@) Total energy of host MyHost1: 2905.000000 Joules
> [ 30.000000] (0:maestro@) Total energy of host MyHost2: 2100.000000 Joules
> [ 30.000000] (0:maestro@) Total energy of host MyHost3: 3000.000000 Joules
> [310.000000] (1:test@MyHost1) Finally, trick the ptask to do a 'remote execution', on host MyHost2
> [320.000000] (1:test@MyHost1) Goodbye now!
> [320.000000] (0:maestro@) Simulation done.
-> [320.000000] (0:maestro@) Total energy of host MyHost1: 39800.000000 Joules
-> [320.000000] (0:maestro@) Total energy of host MyHost2: 40800.000000 Joules
-> [320.000000] (0:maestro@) Total energy of host MyHost3: 39800.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost1: 38200.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost2: 38400.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost3: 38200.000000 Joules
> [ 6.000000] (6:p31@vm_host3) This worker is done.
> [ 6.000000] (7:p32@vm_host3) This worker is done.
> [ 10.000000] (0:maestro@) Total simulation time: 10.00; All hosts must have the exact same energy consumption.
-> [ 10.000000] (0:maestro@) Total energy of host MyHost1: 1600.000000 Joules
-> [ 10.000000] (0:maestro@) Total energy of host MyHost2: 1600.000000 Joules
-> [ 10.000000] (0:maestro@) Total energy of host MyHost3: 1600.000000 Joules
+> [ 10.000000] (0:maestro@) Total energy of host MyHost1: 1120.000000 Joules
+> [ 10.000000] (0:maestro@) Total energy of host MyHost2: 1120.000000 Joules
+> [ 10.000000] (0:maestro@) Total energy of host MyHost3: 1120.000000 Joules
if (cpu_load > 0) { /* Something is going on, the machine is not idle */
double min_power = range.min;
double max_power = range.max;
- double power_slope = max_power - min_power;
- current_power = min_power + cpu_load * power_slope;
+
+ /**
+ * The min_power states how much we consume when only one single
+ * core is working. This means that when cpu_load == 1/coreCount, then
+ * current_power == min_power.
+ *
+ * The maximum must be reached when all cores are working (but 1 core was
+ * already accounted for by min_power)
+ * i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power
+ * (maxCpuLoad is by definition 1)
+ */
+ double power_slope;
+ int coreCount = host->coresCount();
+ if (coreCount > 1)
+ power_slope = (max_power - min_power) / (1 - 1 / coreCount);
+ else
+ power_slope = 0; // Should be 0, since max_power == min_power (in this case)
+
+ current_power = min_power + (cpu_load - (1 / coreCount)) * power_slope;
}
else { /* Our machine is idle, take the dedicated value! */
current_power = range.idle;