vsp
Class Statistics

java.lang.Object
  extended by java.lang.Thread
      extended by vsp.Statistics
All Implemented Interfaces:
Runnable

public class Statistics
extends Thread

Collects statistics of stamp queue

Author:
Jan Tichava

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  ArrayList<Long> lengths
          Collected data
private static int MAX_STARS
          Max stars in histogram
private  QueueWithServer queue
          Watching queue
private  boolean run
          Should scan?
private  long scanTime
          Scanning time
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Statistics(QueueWithServer queue, long scanTime)
          Creates new object
 
Method Summary
private  long[] generateHistogram()
          Generates histogram data
private  String generateStars(long value, long maxValue)
          Generate set of stars for histogram
 long[] getHistogramData()
          Get histogram data
 String getHistogramGraphics()
          Get histogram in ASCII art
 long getMaxLength()
          Get maximum queue length
 double getMedian()
          Get queue's median
 long getMinLength()
          Get minimum queue length
 String getQueueName()
          Get queue name
 double getSigma()
           
 double getVariance()
          Get variance
 void run()
          Run collecting
 void stopCollecting()
          Stop collecting data
 
Methods inherited from class java.lang.Thread
activeCount, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, checkAccess, 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_STARS

private static final int MAX_STARS
Max stars in histogram

See Also:
Constant Field Values

queue

private QueueWithServer queue
Watching queue


scanTime

private long scanTime
Scanning time


run

private boolean run
Should scan?


lengths

private ArrayList<Long> lengths
Collected data

Constructor Detail

Statistics

public Statistics(QueueWithServer queue,
                  long scanTime)
Creates new object

Parameters:
queue -
scanTime -
Method Detail

run

public void run()
Run collecting

Specified by:
run in interface Runnable
Overrides:
run in class Thread

stopCollecting

public void stopCollecting()
Stop collecting data


getMinLength

public long getMinLength()
Get minimum queue length

Returns:

getMaxLength

public long getMaxLength()
Get maximum queue length

Returns:

getMedian

public double getMedian()
Get queue's median

Returns:

getVariance

public double getVariance()
Get variance

Returns:

getSigma

public double getSigma()

getQueueName

public String getQueueName()
Get queue name

Returns:
the queue name

generateHistogram

private long[] generateHistogram()
Generates histogram data

Returns:

getHistogramData

public long[] getHistogramData()
Get histogram data

Returns:

getHistogramGraphics

public String getHistogramGraphics()
Get histogram in ASCII art

Returns:

generateStars

private String generateStars(long value,
                             long maxValue)
Generate set of stars for histogram

Parameters:
value -
maxValue -
Returns: