[477] | 1 | package simulator.stats.implementation; |
---|
| 2 | |
---|
| 3 | import simulator.stats.GSSAccumulator; |
---|
| 4 | import simulator.stats.implementation.out.StatsSerializer; |
---|
| 5 | |
---|
| 6 | /** |
---|
| 7 | * |
---|
| 8 | * @author Marcin Krystek |
---|
| 9 | * |
---|
| 10 | */ |
---|
| 11 | public class AccumulatedResourceStats implements StatsInterface { |
---|
| 12 | |
---|
| 13 | // accumulated resource statistic |
---|
| 14 | protected GSSAccumulator resourceLoad; |
---|
| 15 | protected GSSAccumulator resourceReservationLoad; |
---|
| 16 | protected String resourceName; |
---|
| 17 | |
---|
| 18 | private String[] headers = { "Resource name", "Factor's name", "mean", |
---|
| 19 | "stdev", "variance", "minimum", "maximum", "sum", "count" }; |
---|
| 20 | |
---|
| 21 | public AccumulatedResourceStats(String resourceName) { |
---|
| 22 | this.resourceName = resourceName; |
---|
| 23 | this.resourceLoad = new GSSAccumulator(); |
---|
| 24 | this.resourceReservationLoad = new GSSAccumulator(); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | public String getResourceName() { |
---|
| 28 | return this.resourceName; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | public void addResourceLoad(double load) { |
---|
| 32 | this.resourceLoad.add(load); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | public void addReservationLoad(double load) { |
---|
| 36 | this.resourceReservationLoad.add(load); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | public GSSAccumulator getResourceLoad() { |
---|
| 40 | return this.resourceLoad; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | public GSSAccumulator getResourceReservationLoad() { |
---|
| 44 | return this.resourceReservationLoad; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | public Object serialize(StatsSerializer serializer) { |
---|
| 48 | return serializer.visit(this); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | public String[] getHeaders() { |
---|
| 52 | return headers; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | } |
---|