DRCL J-Sim API

drcl.comp.tool
Class CountMonitor

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.Component
          extended bydrcl.comp.Extension
              extended bydrcl.comp.tool.CountMonitor
All Implemented Interfaces:
java.lang.Cloneable, ObjectCloneable, ObjectDuplicable, java.io.Serializable
Direct Known Subclasses:
TrafficMonitor

public class CountMonitor
extends Extension

This component monitors an "object stream" (defined by Countable) and outputs average rate. It keeps a fixed-size window of objects. The rate at current time is then calculated by summing up the sizes of the objects in the current window divided by the window size. Then the results are exported every outputInterval second. The default window size is 5 seconds and the default output interval is one second.

This component can operate in either "size" mode, "object" mode or both. If the "size" mode is enabled, the component exports the rate, in the unit of the size/second, at the sizecount@ port. If the "object" mode is enabled, it exports the rate, in object/second, at the objcount@ port.

The first exported event is in the following format (drcl.comp.contract.EventMsg):

while the subsequent events are in Double.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class drcl.comp.Component
Component.Locks
 
Field Summary
static java.lang.String OBJ_COUNT_PORT_ID
          ID of the port to export the object-mode events.
static java.lang.String SIZE_COUNT_PORT_ID
          ID of the port to export the size-mode events.
 
Fields inherited from class drcl.comp.Component
FLAG_COMPONENT_NOTIFICATION, FLAG_DEBUG_ENABLED, FLAG_DIRECT_OUTPUT_ENABLED, FLAG_ENABLED, FLAG_ERROR_ENABLED, FLAG_EVENT_ENABLED, FLAG_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, locks, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND
 
Constructor Summary
CountMonitor()
           
CountMonitor(java.lang.String id_)
           
 
Method Summary
 void configure(double wsize_, double uint_)
          Configures this traffic monitor.
 void duplicate(java.lang.Object source_)
          Duplicates the content of source_, including ID, name, child components and connections among them, to this component.
 double getOutputInterval()
          Returns the output interval (in second).
 double getWindowSize()
          Returns the size of the measurement window (in second).
 java.lang.String info()
          Returns information regarding this component.
 boolean isObjModeEnabled()
          Returns true if the "object" mode is enabled.
 boolean isSizeModeEnabled()
          Returns true if the "size" mode is enabled.
 void reset()
          Resets the component for being used anew.
 void setEventNames(java.lang.String objEventName_, java.lang.String sizeEventName_)
          Sets event names for both object/size count events.
 void setObjModeEnabled(boolean enabled_)
          Enables/disables the "object" mode.
 void setOutputInterval(double int_)
          Sets the output interval (in second).
 void setSizeModeEnabled(boolean enabled_)
          Enables/disables the "size" mode.
 void setWindowSize(double size_)
          Sets the size of the measurement window (in second).
 
Methods inherited from class drcl.comp.Extension
isExtensionEnabled, setExtensionEnabled
 
Methods inherited from class drcl.comp.Component
addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getID, getName, getParent, getPort, getPort, getRoot, getTime, iduplicate, isAncestorOf, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectlyRelatedTo, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, setTraceEnabled, setTraceEnabled, sleepFor, sleepUntil, stop, toString, unexpose, unlock, useLocalForkManager, useLocalForkManager, wait
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OBJ_COUNT_PORT_ID

public static final java.lang.String OBJ_COUNT_PORT_ID
ID of the port to export the object-mode events.

See Also:
Constant Field Values

SIZE_COUNT_PORT_ID

public static final java.lang.String SIZE_COUNT_PORT_ID
ID of the port to export the size-mode events.

See Also:
Constant Field Values
Constructor Detail

CountMonitor

public CountMonitor()

CountMonitor

public CountMonitor(java.lang.String id_)
Method Detail

reset

public void reset()
Description copied from class: Component
Resets the component for being used anew. All the internal variables must be set to the initial state. All the ports and child components are reset as well.

Overrides:
reset in class Component

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: Component
Duplicates the content of source_, including ID, name, child components and connections among them, to this component. Subclasses need to override this method to copy its own variables.

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class Component

info

public java.lang.String info()
Description copied from class: Component
Returns information regarding this component. Subclasses should override this method to provide useful information at run time.

Overrides:
info in class Component

configure

public void configure(double wsize_,
                      double uint_)
Configures this traffic monitor.

Parameters:
wsize_ - the window size in second.
uint_ - the output interval in second.

setEventNames

public void setEventNames(java.lang.String objEventName_,
                          java.lang.String sizeEventName_)
Sets event names for both object/size count events.


setOutputInterval

public void setOutputInterval(double int_)
Sets the output interval (in second).


getOutputInterval

public double getOutputInterval()
Returns the output interval (in second).


setWindowSize

public void setWindowSize(double size_)
Sets the size of the measurement window (in second).


getWindowSize

public double getWindowSize()
Returns the size of the measurement window (in second).


setObjModeEnabled

public void setObjModeEnabled(boolean enabled_)
Enables/disables the "object" mode.


isObjModeEnabled

public boolean isObjModeEnabled()
Returns true if the "object" mode is enabled.


setSizeModeEnabled

public void setSizeModeEnabled(boolean enabled_)
Enables/disables the "size" mode.


isSizeModeEnabled

public boolean isSizeModeEnabled()
Returns true if the "size" mode is enabled.


DRCL J-Sim API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~