/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* ident "%Z%%M% %I% %E% SMI"
*/
/**
* This represents a monitored resource and the techniques used to
* monitor the resource.
*/
{
/**
* The monitored resource.
*/
/**
* The size of the statistic buffer.
*/
private final int maxSize;
/**
* Cached list of components to be monitored.
*/
/**
* Constructor. No monitor target and a default buffer size of
* 50.
*/
public ResourceMonitor()
{
this(null, 50);
}
/**
* Constructor.
*
* @param target The resource to be monitored.
* @param maxSize The maximum number of samples to be held.
*/
{
super();
compList = new LinkedList();
}
/**
* Initialize the resource monitor with it's list of
* components. Components which are off-line or powered-off
* cannot be monitored, so they should be removed from the
* list of components.
*
* @throws PoolsException if there is an error accessing the
* pool elements.
*/
{
}
}
/**
* Get the list of components which are actively monitored by
* this resource.
*/
{
}
/**
* Return the maximum number of samples this monitor will
* hold.
*/
public int getMaxSampleSize()
{
return (maxSize);
}
/**
* Return the object which is being monitored.
*/
{
return (target);
}
/**
* Set the resource to be monitored. A resource target can
* only be set once, if you attempt to modify it then an
* IllegalArgumentException is thrown.
*
* @param target The resource to be monitored.
* @throws IllegalArgumentException if the target has already
* been set.
*/
{
else
throw new IllegalArgumentException("Once the target " +
"of a ResourceMonitor is set, it cannot be " +
"changed.");
}
/**
* Return the name of the monitored object.
*
* @throws PoolsException if there is an error accessing the
* pool element.
*/
{
}
/**
* Update the derived statistics.
*/
public void updateDerived()
{
}
/**
* Get a derived statistic.
*
* @param name The name of the statistic to get.
*/
{
getLast());
}
/**
* Return the latest value of a derived statistic.
*
* @param name is the name of the derived statistic to be
* returned.
*/
{
/*
* The only statistic which can be obtained from this
* resource monitor is utilization. A utilization
* statistic actually represents a complex
* manipulation of several lower level
* statistics. This manipulation is performed here
* until a good interface can be thought through which
* best captures this abstraction.
*/
throw new IllegalArgumentException("No such derived "
+ "statistic: " + name);
/*
* This statistic is based on lower level
* monotonically increasing numbers. The statistic can
* thus only be derived as an observation of the
* change in value over time of these values.
*/
case 0:
case 1:
return (null);
default:
double utilV = 0.0;
double idleV = 0.0;
get(i));
doubleValue();
}
total.doubleValue());
}
}
{
}
}