[477] | 1 | package simulator.stats.implementation; |
---|
| 2 | |
---|
[1396] | 3 | import simulator.stats.DCwormsAccumulator; |
---|
[477] | 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 |
---|
[1396] | 14 | protected DCwormsAccumulator resourceLoad; |
---|
| 15 | protected DCwormsAccumulator resourceReservationLoad; |
---|
[477] | 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; |
---|
[1396] | 23 | this.resourceLoad = new DCwormsAccumulator(); |
---|
| 24 | this.resourceReservationLoad = new DCwormsAccumulator(); |
---|
[477] | 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 | |
---|
[1396] | 39 | public DCwormsAccumulator getResourceLoad() { |
---|
[477] | 40 | return this.resourceLoad; |
---|
| 41 | } |
---|
| 42 | |
---|
[1396] | 43 | public DCwormsAccumulator getResourceReservationLoad() { |
---|
[477] | 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 | } |
---|