001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.geronimo.samples.daytrader.util; 018 019 /** 020 * @author stancox 021 * 022 * To change this generated comment edit the template variable "typecomment": 023 * Window>Preferences>Java>Templates. 024 * To enable and disable the creation of type comments go to 025 * Window>Preferences>Java>Code Generation. 026 */ 027 public class TimerStat { 028 029 private double min=1000000000.0, max=0.0, totalTime=0.0; 030 private int count; 031 /** 032 * Returns the count. 033 * @return int 034 */ 035 public int getCount() { 036 return count; 037 } 038 039 /** 040 * Returns the max. 041 * @return double 042 */ 043 public double getMax() { 044 return max; 045 } 046 047 /** 048 * Returns the min. 049 * @return double 050 */ 051 public double getMin() { 052 return min; 053 } 054 055 /** 056 * Sets the count. 057 * @param count The count to set 058 */ 059 public void setCount(int count) { 060 this.count = count; 061 } 062 063 /** 064 * Sets the max. 065 * @param max The max to set 066 */ 067 public void setMax(double max) { 068 this.max = max; 069 } 070 071 /** 072 * Sets the min. 073 * @param min The min to set 074 */ 075 public void setMin(double min) { 076 this.min = min; 077 } 078 079 /** 080 * Returns the totalTime. 081 * @return double 082 */ 083 public double getTotalTime() { 084 return totalTime; 085 } 086 087 /** 088 * Sets the totalTime. 089 * @param totalTime The totalTime to set 090 */ 091 public void setTotalTime(double totalTime) { 092 this.totalTime = totalTime; 093 } 094 095 /** 096 * Returns the max in Secs 097 * @return double 098 */ 099 public double getMaxSecs() { 100 return max/1000.0; 101 } 102 103 /** 104 * Returns the min in Secs 105 * @return double 106 */ 107 public double getMinSecs() { 108 return min/1000.0; 109 } 110 111 /** 112 * Returns the average time in Secs 113 * @return double 114 */ 115 public double getAvgSecs() { 116 117 double avg = (double)getTotalTime() / (double)getCount(); 118 return avg / 1000.0; 119 } 120 121 122 }