GridSim 5.0 beta

gridsim
Class GridStatistics

Object
  extended by Thread
      extended by Sim_entity
          extended by GridStatistics
All Implemented Interfaces:
Cloneable, Runnable

public class GridStatistics
extends Sim_entity

Records statistical data reported by other entities.

It stores data objects along with its arrival time and the ID of the machine and the PE (Processing Element) allocated to it. It acts as a placeholder for maintaining the amount of resource share allocated at various times for simulating time-shared scheduling using internal events.

Since:
GridSim Toolkit 1.0
Author:
Manzur Murshed and Rajkumar Buyya
Invariant:
$none

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GridStatistics(String name)
          Allocates a new GridStatistics object
GridStatistics(String name, String fileName, boolean append, String[] excludeFromFile, String[] excludeFromProcessing)
          Allocates a new GridStatistics object with a set of parameters
 
Method Summary
 Accumulator accumulate(String category)
          Accumulates objects based on a given category
 Accumulator accumulate(String category, String counter)
          Accumulates objects based on a given category
 void body()
          A method that gets one process event at one time until the end of a simulation, then records its statistics.
 void recordStat(Stat stat)
          Records the given statistics into a file
 void returnAccStatByCategory(Sim_event ev)
          Sends an Accumulator object based on category into an event scheduler.
 
Methods inherited from class Sim_entity
add_generator, add_param, add_port, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridStatistics

public GridStatistics(String name)
               throws Exception
Allocates a new GridStatistics object

Parameters:
name - the entity name
Throws:
Exception - This happens when creating this entity before initializing GridSim package or this entity name is null or empty
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String)
Pre Condition:
name != null
Post Condition:
$none

GridStatistics

public GridStatistics(String name,
                      String fileName,
                      boolean append,
                      String[] excludeFromFile,
                      String[] excludeFromProcessing)
               throws Exception
Allocates a new GridStatistics object with a set of parameters

Parameters:
name - the entity name
fileName - the file name to be written into
append - if it is true, then bytes will be written to the end of the file rather than the beginning
excludeFromFile - List of names to be excluded from statistics
excludeFromProcessing - List of names to be excluded from writing into a file
Throws:
Exception - This happens when creating this entity before initializing GridSim package or this entity name is null or empty
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String)
Pre Condition:
name != null, fileName != null
Post Condition:
$none
Method Detail

accumulate

public Accumulator accumulate(String category)
Accumulates objects based on a given category

Parameters:
category - user-defined name for data type
Returns:
an Accumulator object contains double values of objects that match the given category
See Also:
Accumulator
Pre Condition:
category != null
Post Condition:
$result != null

accumulate

public Accumulator accumulate(String category,
                              String counter)
Accumulates objects based on a given category

Parameters:
category - user-defined name for data type
counter - user-defined name for data type
Returns:
an Accumulator object contains double values of objects that match the given category
See Also:
Accumulator
Pre Condition:
category != null, counter != null
Post Condition:
$result != null

body

public void body()
A method that gets one process event at one time until the end of a simulation, then records its statistics.

The services available to other GridSim entities are:

Overrides:
body in class Sim_entity
Pre Condition:
$none
Post Condition:
$none

recordStat

public void recordStat(Stat stat)
Records the given statistics into a file

Parameters:
stat - a Stat object
See Also:
Stat
Pre Condition:
stat != null
Post Condition:
$none

returnAccStatByCategory

public void returnAccStatByCategory(Sim_event ev)
Sends an Accumulator object based on category into an event scheduler.

Parameters:
ev - an object of Sim_event
See Also:
Sim_event
Pre Condition:
ev != null
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009