JanosVM v1.0 API

edu.utah.janosvm.kit.management.team
Class ResourceMonitor

java.lang.Object
  |
  +--edu.utah.janosvm.kit.management.team.ResourceMonitor
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
CPUMonitor, MemoryMonitor

public class ResourceMonitor
extends java.lang.Object
implements java.lang.Runnable

Base class for applications that want to poll team's about their resource consumption. An application is expected to start a thread and execute the run() method to actually perform the polling.


Field Summary
private  int iterations
          The number of times to poll.
private  long msInterval
          The millisecond interval between polls.
private  java.lang.Class sampler
          The class used to sample the state of a team.
private  java.util.Vector samplers
          The set of ResourceSamplers held by this monitor.
 
Constructor Summary
ResourceMonitor(java.lang.Class sampler)
          Construct a ResourceMonitor with the given values.
ResourceMonitor(int iterations, long msInterval, java.lang.Class sampler)
          Construct a ResourceMonitor with the given values.
 
Method Summary
 ResourceMonitor addTeams(java.lang.String[] names)
          Add a number of teams that should be monitored.
 void beginSampling()
           
 void endSampling()
           
 void run()
          Poll the teams.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0
 

Field Detail

iterations

private final int iterations
The number of times to poll.

msInterval

private final long msInterval
The millisecond interval between polls.

sampler

private final java.lang.Class sampler
The class used to sample the state of a team.

samplers

private final java.util.Vector samplers
The set of ResourceSamplers held by this monitor.
Constructor Detail

ResourceMonitor

public ResourceMonitor(int iterations,
                       long msInterval,
                       java.lang.Class sampler)
Construct a ResourceMonitor with the given values.
Parameters:
iterations - The number of times to poll.
msInterval - The millisecond interval between polls.
sampler - The class used to sample the state of a team.

ResourceMonitor

public ResourceMonitor(java.lang.Class sampler)
Construct a ResourceMonitor with the given values. The default iteration count is infinite and the default interval is one second.
Parameters:
sampler - The class used to sample the state of a team.
Method Detail

addTeams

public ResourceMonitor addTeams(java.lang.String[] names)
                         throws java.lang.InstantiationException,
                                java.lang.IllegalAccessException
Add a number of teams that should be monitored.
Parameters:
names - The names of the teams to monitor.
Returns:
this

run

public void run()
Poll the teams.
Specified by:
run in interface java.lang.Runnable

beginSampling

public void beginSampling()

endSampling

public void endSampling()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

JanosVM v1.0 API

This documentation is Copyright (C) 2000-2003 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Feb 13, 2003