hu.mta.sztaki.lpds.cloud.simulator.energy
Class MonitorConsumption

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.Timed
      extended by hu.mta.sztaki.lpds.cloud.simulator.energy.MonitorConsumption
All Implemented Interfaces:
Comparable<Timed>

public class MonitorConsumption
extends Timed

This class is an initial framework to collect periodical reports on consumptions. In its current state it is too rigid and needs more customization. However, if extended further it would allow a single consumption monitor to be added to a particular resourcespreader, eliminating the need for multiple queries on the getTotalProcessed function. NOTE: this class is outdated and might perform badly.

Author:
"Gabor Kecskemeti, Distributed and Parallel Systems Group, University of Innsbruck (c) 2013"

Nested Class Summary
private static class MonitorConsumption.SpreadingRecord
          the collected totalprocessed data with timestamps to allow seeing the temporal behavior of totalprocessed
 
Field Summary
private  long aSecond
          the amount of ticks it takes for a single second to pass in the simulated time
private  double subDayProcessing
          the total processing accomplished in the last day
private  PriorityQueue<MonitorConsumption.SpreadingRecord> subDayRecords
          all spreading records collected during the past day
private  double subHourProcessing
          the total processing accomplished in the last hour
private  PriorityQueue<MonitorConsumption.SpreadingRecord> subHourRecords
          all spreading records that were collected during the past hour
private  double subSecondProcessing
          the amount of processing done in the last second
(package private)  ResourceSpreader toMonitor
          what resource spreader to collect the totalprocessed values from
private  double totalProcessed
          the totalprocessed value of the spreader during the last collection
 
Constructor Summary
MonitorConsumption(ResourceSpreader toMonitor, long aSecond)
          Initiates a monitoring session for the resource consumptions of a particular resource spreader
 
Method Summary
 void cancelMonitoring()
          allows the monitoring to be terminated at any arbitrary point of time.
 double getSubDayProcessing()
          the amount of processing done in a the past day (this is a rolling day always assumed to start a day before this function was called)
 double getSubHourProcessing()
          the amount of processing done in a the past hour (this is a rolling hour always assumed to start a hour before this function was called)
 double getSubSecondProcessing()
          the amount of processing done in a the past second (this is a rolling second always assumed to start a second before this function was called)
 void tick(long fires)
          Data collector function that updates all processing data records and throws out the too old records as well.
 
Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.Timed
calcTimeJump, compareTo, fire, getFireCount, getFrequency, getNextEvent, getNextFire, isSubscribed, jumpTime, nextEventDistance, resetTimed, setBackPreference, simulateUntil, simulateUntilLastEvent, skipEventsTill, subscribe, toString, unsubscribe, updateFrequency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

toMonitor

final ResourceSpreader toMonitor
what resource spreader to collect the totalprocessed values from


subHourRecords

private PriorityQueue<MonitorConsumption.SpreadingRecord> subHourRecords
all spreading records that were collected during the past hour


subDayRecords

private PriorityQueue<MonitorConsumption.SpreadingRecord> subDayRecords
all spreading records collected during the past day


subHourProcessing

private double subHourProcessing
the total processing accomplished in the last hour


subDayProcessing

private double subDayProcessing
the total processing accomplished in the last day


totalProcessed

private double totalProcessed
the totalprocessed value of the spreader during the last collection


subSecondProcessing

private double subSecondProcessing
the amount of processing done in the last second


aSecond

private final long aSecond
the amount of ticks it takes for a single second to pass in the simulated time

Constructor Detail

MonitorConsumption

public MonitorConsumption(ResourceSpreader toMonitor,
                          long aSecond)
Initiates a monitoring session for the resource consumptions of a particular resource spreader

Parameters:
toMonitor - the resource spreader to be monitored
aSecond - the amount of ticks it takes to get to one second in the current configuration of the simulation, if this should be below 1 then the monitor consumption class should not be used
Method Detail

getSubDayProcessing

public double getSubDayProcessing()
the amount of processing done in a the past day (this is a rolling day always assumed to start a day before this function was called)

Returns:
the processing done in the past day

getSubHourProcessing

public double getSubHourProcessing()
the amount of processing done in a the past hour (this is a rolling hour always assumed to start a hour before this function was called)

Returns:
the processing done in the past hour

getSubSecondProcessing

public double getSubSecondProcessing()
the amount of processing done in a the past second (this is a rolling second always assumed to start a second before this function was called)

Returns:
the processing done in the past second

tick

public void tick(long fires)
Data collector function that updates all processing data records and throws out the too old records as well.

Specified by:
tick in class Timed
Parameters:
fires - The particular time instance when the function was called. The time instance is passed so the tick functions will not need to call getFireCount() if they need to operate on the actual time.

cancelMonitoring

public void cancelMonitoring()
allows the monitoring to be terminated at any arbitrary point of time. The processing data reports are not going to be update anymore and they are going to be always valid for the time instance where the cancel operation was called.



Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.