[Xorio-commit] SF.net SVN: xorio: [407] trunk/src/java/com/klaiber/xorio/util/monitor/ Performance
Status: Alpha
Brought to you by:
sklaiber
|
From: <skl...@us...> - 2007-01-03 14:27:28
|
Revision: 407
http://svn.sourceforge.net/xorio/?rev=407&view=rev
Author: sklaiber
Date: 2007-01-03 06:27:23 -0800 (Wed, 03 Jan 2007)
Log Message:
-----------
Inital Version
* Implementation of a Defined Performance Measurement Point
Added Paths:
-----------
trunk/src/java/com/klaiber/xorio/util/monitor/PerformanceMonitorItemImpl.java
Added: trunk/src/java/com/klaiber/xorio/util/monitor/PerformanceMonitorItemImpl.java
===================================================================
--- trunk/src/java/com/klaiber/xorio/util/monitor/PerformanceMonitorItemImpl.java (rev 0)
+++ trunk/src/java/com/klaiber/xorio/util/monitor/PerformanceMonitorItemImpl.java 2007-01-03 14:27:23 UTC (rev 407)
@@ -0,0 +1,73 @@
+/**
+ *
+ */
+package com.klaiber.xorio.util.monitor;
+
+/**
+ * @author klaiber
+ *
+ */
+public class PerformanceMonitorItemImpl implements PerformaceMonitorItem {
+
+ private String _name;
+ private long _max=-1;
+ private long _min=-1;
+ private long _sum=0;
+ private int _count=0;
+
+ protected PerformanceMonitorItemImpl(String name, long duration) {
+ this._name = name.toLowerCase();
+ this.addMeasurement(duration);
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.klaiber.xorio.util.monitor.PerformaceMonitorItem#addMeasurement(int)
+ */
+ public void addMeasurement(long duration) {
+ this._sum = this._sum + duration;
+ this._count++;
+ if (duration > this._max) {
+ this._max = duration;
+ }
+ if (duration < this._min || this._min < 0) {
+ this._min = duration;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.klaiber.xorio.util.monitor.PerformaceMonitorItem#getAvg()
+ */
+ public long getAvg() {
+ return this._sum/this._count;
+ }
+
+ /* (non-Javadoc)
+ * @see com.klaiber.xorio.util.monitor.PerformaceMonitorItem#getMax()
+ */
+ public long getMax() {
+ return this._max;
+ }
+
+ /* (non-Javadoc)
+ * @see com.klaiber.xorio.util.monitor.PerformaceMonitorItem#getMeasurementCount()
+ */
+ public int getMeasurementCount() {
+ return this._count;
+ }
+
+ /* (non-Javadoc)
+ * @see com.klaiber.xorio.util.monitor.PerformaceMonitorItem#getMin()
+ */
+ public long getMin() {
+ return this._min;
+ }
+
+ /* (non-Javadoc)
+ * @see com.klaiber.xorio.util.monitor.PerformaceMonitorItem#getName()
+ */
+ public String getName() {
+ return this._name;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|