stella.sensor
Class HealthSensor

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.rmi.RmiPropertyContainer
                  extended by util.rmi.AbstractRmiCaster
                      extended by stella.sensor.AbstractSensor
                          extended by stella.sensor.TimerTaskSensor
                              extended by stella.sensor.DataSensor
                                  extended by stella.sensor.CumulativeSensor
                                      extended by stella.sensor.PredictiveSensor
                                          extended by stella.sensor.SmoothingSensor
                                              extended by stella.sensor.DerivativeSensor
                                                  extended by stella.sensor.WeatherSensor
                                                      extended by stella.sensor.HealthSensor
All Implemented Interfaces:
Cloneable, Remote, Caster, DataCaster, RmiDataCaster, RmiErrorCaster, Cumulating, Deriving, Predicting, Smoothing, Telemetering, WeatherJudging, WeatherCaster, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiPropertyBearing

public class HealthSensor
extends WeatherSensor

A class to monitor voltage and temperature of the computer core. To allow different sensors to be derived from the same base class the value KEY_SYSTEMSENSOR must be one of the valid /proc-paths used by the system's chipset. It default to the CPU temperature on a via686a sensor chipset. On the default system valid proc paths are (derived from a via686a sensor chip):

All via686a register readings are treated as physical quantities. If you have to port the class to other systems you may be forced to write your own conversions if you want to stick to the ConvertToPhysical and/or PhysicalDerivative functionality.


Nested Class Summary
static class HealthSensor.Test
          Test purpose only.
 
Nested classes/interfaces inherited from class stella.sensor.TimerTaskSensor
TimerTaskSensor.SensorRead
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static File DEFPROCPATH
          The system path that should be identical on different linux systems.
private static String DEFSYSTEMSENSOR
          The default sensor, default chipset.
static String KEY_PROCPATH
          The key defining the proc path to the system sensors.
static String KEY_SYSTEMSENSOR
          The key defining the system sensor to read.
 
Fields inherited from class stella.sensor.WeatherSensor
KEY_DERIVATIVEINVALID, KEY_DERIVATIVEPARAMETER, KEY_INVERSE, KEY_INVERSEDERIVATIVE, KEY_JUDGEDERIVATIVE, KEY_JUDGEPREDICT, KEY_JUDGERAW, KEY_JUDGESMOOTH, KEY_PREDICTINVALID, KEY_PREDICTPARAMETER, KEY_RAWINVALID, KEY_RAWPARAMETER, KEY_RETARDBADDERIVATIVE, KEY_RETARDBADPREDICT, KEY_RETARDBADRAW, KEY_RETARDBADSMOOTH, KEY_RETARDGOODDERIVATIVE, KEY_RETARDGOODPREDICT, KEY_RETARDGOODRAW, KEY_RETARDGOODSMOOTH, KEY_SMOOTHINVALID, KEY_SMOOTHPARAMETER
 
Fields inherited from class stella.sensor.DerivativeSensor
DEFRAWDERIVATIVE, derive, KEY_DERIVATIVEADVISE, KEY_DERIVE, KEY_PATH, KEY_RAWDERIVATIVE, z
 
Fields inherited from class stella.sensor.SmoothingSensor
f, g, KEY_SMOOTH, KEY_SMOOTHADVISE
 
Fields inherited from class stella.sensor.PredictiveSensor
KEY_BASE, KEY_CHI, KEY_EXTRAPOLATE, KEY_FUTURE, KEY_PREDICTADVISE, predict
 
Fields inherited from class stella.sensor.CumulativeSensor
KEY_AVERAGE, KEY_MEMORY, KEY_PACK
 
Fields inherited from class stella.sensor.DataSensor
DEFRAWFORMAT, DEFREPORT, DEFSIGMAFORMAT, KEY_RAWFORMAT, KEY_REPORT, KEY_SIGMAFORMAT
 
Fields inherited from class stella.sensor.TimerTaskSensor
KEY_RESPAWN
 
Fields inherited from class stella.sensor.AbstractSensor
KEY_BIND, KEY_BINDNAME, KEY_CONVERT, KEY_DESCRIPTION, KEY_SENSORNAME
 
Fields inherited from class util.rmi.AbstractRmiCaster
ALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface stella.rmi.RmiDataCaster
NAMING_EXTENSION
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
HealthSensor(Map qualify)
          Constructs a new health sensor with the specified properties.
 
Method Summary
 File getSystemSensor()
          Returns the system sensor as a File object.
protected  double readSensor()
          Reads the system sensor specified by the KEY_SYSTEMSENSOR.
 boolean validReading()
          A health sensor is always valid if the proc path and the system sensor are given.
 
Methods inherited from class stella.sensor.WeatherSensor
addWeatherListener, conductOneMeasure, currentlyClear, currentlyRetarding, generateDataEvent, getMinClearUpTime, getSensorInitInfo, goodFromDerivative, goodFromPredict, goodFromRaw, goodFromSmooth, isDerivativeRetard, isPredictRetard, isRawRetard, isSmoothRetard, judgeWeather, notifyWeatherListener, removeWeatherListener, status
 
Methods inherited from class stella.sensor.DerivativeSensor
deriveAt, getDerivativeFormat, getDerivativeToggleInfo, getDerivator, getLastDerivative, isDerivativeAdvise, isDeriving, newData, regetDerive, registerDerivator
 
Methods inherited from class stella.sensor.SmoothingSensor
getLastSmooth, getSmoother, getSmoothToggleInfo, isSmoothAdvise, isSmoothing, regetSmooth, registerSmoother, smoothOne
 
Methods inherited from class stella.sensor.PredictiveSensor
getExtrapolation, getLastPredict, getPredictToggleInfo, isPredictAdvise, isPredicting, isReliable, predictFrom, regetPredict
 
Methods inherited from class stella.sensor.CumulativeSensor
cumulateOne, getLastRaw, getLastTime, getMaxSize, getMemory, getSize
 
Methods inherited from class stella.sensor.DataSensor
addDataListener, addRmiDataListener, exit, getRawFormat, getSigmaFormat, removeDataListener, removeRmiDataListener, report
 
Methods inherited from class stella.sensor.TimerTaskSensor
cancel, equals, getRawToggleInfo, getReading, getRespawn, getTimeOfRead, hashCode, initSensorTimerTask, isReady, regetRaw, setTimeOfRead, validReading
 
Methods inherited from class stella.sensor.AbstractSensor
addRmiErrorListener, createSensor, getBindName, getConvert, getSensorDescription, getSensorName, init, notifyErrorListener, removeRmiErrorListener, setConvert, toString
 
Methods inherited from class util.rmi.AbstractRmiCaster
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistry
 
Methods inherited from class util.rmi.RmiPropertyContainer
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.sensor.Cumulating
cumulateOne, getLastRaw, getLastTime, getMaxSize, getSize, getTimeOfRead, regetRaw
 
Methods inherited from interface util.rmi.RmiCaster
bindToRegistry, isValid, unbindFromRegistry
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_SYSTEMSENSOR

public static final String KEY_SYSTEMSENSOR
The key defining the system sensor to read.

See Also:
Constant Field Values

KEY_PROCPATH

public static final String KEY_PROCPATH
The key defining the proc path to the system sensors.

See Also:
Constant Field Values

DEFSYSTEMSENSOR

private static final String DEFSYSTEMSENSOR
The default sensor, default chipset.

See Also:
Constant Field Values

DEFPROCPATH

private static final File DEFPROCPATH
The system path that should be identical on different linux systems.

Constructor Detail

HealthSensor

public HealthSensor(Map qualify)
             throws RemoteException
Constructs a new health sensor with the specified properties. Note that this properties should contain the name of the system sensor to read.

Throws:
RemoteException
Method Detail

getSystemSensor

public File getSystemSensor()
Returns the system sensor as a File object. Reading the system sensor can be done by opening an InputStream on the returned File.


readSensor

protected double readSensor()
Reads the system sensor specified by the KEY_SYSTEMSENSOR. The system sensors are readable via the /proc file system. Each system sensor corresponds to a File object in the /proc file system. Note that this file system is very system depended and porting this health sensor to other OSs may cause problems. The general contract for reading the sensor information out of the file is that the last double value read is the actual sensor information.

As an implementation detail it should be noted that on our redhat linux system the system sensor can only be read if a BufferedReader is asociated with the input stream. Note also that querrying the stream with the InputStream.available() or the BufferedReader's BufferedReader.ready() will return 0 or false, respectively, independend of the state of the stream. Reading less information than a whole line at once from the stream blocks further input and should be avoided.

Specified by:
readSensor in class TimerTaskSensor
See Also:
ConvertToPhysical

validReading

public boolean validReading()
A health sensor is always valid if the proc path and the system sensor are given.