source: xssim/trunk/src/simulator/stats/implementation/ResourceUsageStats.java @ 104

Revision 104, 1.3 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package simulator.stats.implementation;
2
3import java.util.Map;
4import java.util.TreeMap;
5
6import simulator.stats.implementation.out.StatsSerializer;
7import test.rewolucja.resources.ResourceType;
8
9/**
10 *
11 * @author Marcin Krystek
12 *
13 */
14public class ResourceUsageStats implements StatsInterface {
15
16        protected Map<Long, Integer> usage;
17        protected String resourceName;
18        protected String usageType;
19        protected ResourceType resourceType;
20        protected double meanUsage;
21       
22        public void setMeanUsage(double meanUsage) {
23                this.meanUsage = meanUsage;
24        }
25
26        private String[] headers = { "resourceName", "timestamp", "usage" };
27
28        public ResourceUsageStats(String resourceName, ResourceType resourceType, String usageType) {
29                this.resourceName = resourceName;
30                this.resourceType = resourceType;
31                this.usageType = usageType;
32                this.usage = new TreeMap<Long, Integer>();
33                this.meanUsage = 0;
34        }
35
36        public double getMeanUsage() {
37                return meanUsage;
38        }
39
40        public String getResourceName() {
41                return this.resourceName;
42        }
43       
44        public ResourceType getResourceType() {
45                return resourceType;
46        }
47       
48        public String getUsageType() {
49                return this.usageType;
50        }       
51
52        public Map<Long, Integer> getUsage() {
53                return this.usage;
54        }
55
56        public Object serialize(StatsSerializer serializer) {
57                return serializer.visit(this);
58        }
59
60        public String[] getHeaders() {
61                return headers;
62        }
63
64}
Note: See TracBrowser for help on using the repository browser.