Repository navigation
Expand file tree
/
Copy pathPowerModelSpecPower.java
More file actions
77 lines (68 loc) · 2.84 KB
/
Copy pathPowerModelSpecPower.java
File metadata and controls
77 lines (68 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2012, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.power.models;
/**
* The abstract class of power models created based on data from SPECpower benchmark:
* http://www.spec.org/power_ssj2008/
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public abstract class PowerModelSpecPower implements PowerModel {
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1");
}
if (utilization % 0.1 == 0) {
return getPowerData((int) (utilization * 10));
}
int utilization1 = (int) Math.floor(utilization * 10);
int utilization2 = (int) Math.ceil(utilization * 10);
double power1 = getPowerData(utilization1);
double power2 = getPowerData(utilization2);
double delta = (power2 - power1) / 10;
double power = power1 + delta * (utilization - (double) utilization1 / 10) * 100;
return power;
}
public double getPowerEstimation(double utilization, double voltage, double frequency) {
return powerEstimation(utilization, voltage, frequency);
}
public double getFrequency(int operatingPoint) {
return frequency(operatingPoint);
}
public double getVoltage(int operatingPoint, int voltageClass, int configuration) {
return voltage(operatingPoint, voltageClass, configuration);
}
public double getEstimationOverhead(int vmClass, int operatingPoint) {
return estimationOverhead(vmClass, operatingPoint);
}
/**
* Gets the power data.
*
* @param index the index
* @return the power data
*/
protected abstract double getPowerData(int index);
protected abstract double powerEstimation(double utilization, double voltage, double frequency);
protected abstract double frequency(int operatingPoint);
protected abstract double voltage(int operatingPoint, int voltageClass, int configuration);
protected abstract double estimationOverhead(int vmClass, int operatingPoint);
}