source: DCWoRMS/trunk/src/simulator/stats/implementation/ResourceStats.java @ 477

Revision 477, 1.6 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
RevLine 
[477]1package simulator.stats.implementation;
2
3import java.util.HashMap;
4import java.util.Map;
5
6import schedframe.resources.computing.ComputingResource;
7import simulator.stats.implementation.out.StatsSerializer;
8
9public class ResourceStats implements StatsInterface {
10
11        // raw resource statistic
12        protected String resourceName;
13        protected int cpucnt;
14        protected int cpuspeed;
15        protected int memory;
16        protected double queueLength;
17        protected Map<String, Double> processorsLoad;
18        protected Map<String, Double> processorsReservationLoad;
19
20        private String[] headers = { "resourceName", "memory", "cpu", "cpu_speed",
21                        "queue_length", "cpu_load", "reservation_load" };
22
23        public ResourceStats(ComputingResource compResource) {
24                this.resourceName = compResource.getName();
25                init();
26
27        }
28
29        public void init() {
30                this.cpucnt = 0;
31                this.cpuspeed = 0;
32                this.memory = 0;
33                this.queueLength = 0;
34                this.processorsLoad = new HashMap<String, Double>();
35                this.processorsReservationLoad = new HashMap<String, Double>();
36        }
37
38        public double getQueueLength() {
39                return queueLength;
40        }
41
42        public void setQueueLength(double queueLength) {
43                this.queueLength = queueLength;
44        }
45
46        public Map<String, Double> getPELoad() {
47                return processorsLoad;
48        }
49
50        public Map<String, Double> getProcessorsReservationLoad() {
51                return processorsReservationLoad;
52        }
53
54        public String getResourceName() {
55                return resourceName;
56        }
57
58        public int getCpucnt() {
59                return cpucnt;
60        }
61
62        public int getCpuspeed() {
63                return cpuspeed;
64        }
65
66        public int getMemory() {
67                return memory;
68        }
69
70        public Object serialize(StatsSerializer serializer) {
71                return serializer.visit(this);
72        }
73
74        public String[] getHeaders() {
75                return headers;
76        }
77
78}
Note: See TracBrowser for help on using the repository browser.