org/objectweb/proactive/benchmarks/timit/util/TimerCounter.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
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 }

Generated on Mon Jan 22 15:16:04 2007 for ProActive by  doxygen 1.5.1