00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.benchmarks.timit.util;
00032
00033 import java.io.Serializable;
00034
00041 public class TimerCounter implements Serializable {
00042
00046 private static final long serialVersionUID = 6077443063543623646L;
00047
00048 private int id;
00049
00050 private String name;
00051
00052 private HierarchicalTimer timer;
00053
00060 public TimerCounter(String s) {
00061 this.name = s;
00062 this.id = -1;
00063 this.timer = FakeTimer.getInstance();
00064 }
00065
00071 public void setId(int n) {
00072 this.id = n;
00073 }
00074
00080 public void setName(String s) {
00081 this.name = s;
00082 }
00083
00089 public int getId() {
00090 return this.id;
00091 }
00092
00098 public String getName() {
00099 return this.name;
00100 }
00101
00107 public void setTimer(HierarchicalTimer timer) {
00108 this.timer = timer;
00109 }
00110
00114 public boolean isMigratable() {
00115 return false;
00116 }
00117
00123 public void start() {
00124 this.timer.start(this.id);
00125 }
00126
00132 public void stop() {
00133 this.timer.stop(this.id);
00134 }
00135
00143 public void setValue(int t) {
00144 this.timer.setValue(this.id, t);
00145 }
00146
00154 public void addValue(int t) {
00155 this.timer.addValue(this.id, t);
00156 }
00157
00164 public boolean isStarted() {
00165 return this.timer.isStarted(this.id);
00166 }
00167
00171 public int getElapsedTime() {
00172 return this.timer.getElapsedTime(this.id);
00173 }
00174
00178 public int getHierarchicalTime() {
00179 return this.timer.getHierarchicalTime(this.id);
00180 }
00181
00186 public int getTotalTime() {
00187 return this.timer.getTotalTime(this.id);
00188 }
00189
00193 public void reset() {
00194 this.timer.resetCounter(this.id);
00195 }
00196 }