fr.dyade.aaa.common
Class AverageLoadTask

java.lang.Object
  extended by java.util.TimerTask
      extended by fr.dyade.aaa.common.AverageLoadTask
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
Engine.EngineAverageLoadTask, Network.NetworkAverageLoadTask

public abstract class AverageLoadTask
extends java.util.TimerTask

This class computes the load average of the server using Unix algorithm. This task needs is scheduled every 5 seconds.


Field Summary
(package private)  long averageLoad1
          load averages for the last minute.
(package private)  long averageLoad15
          load averages for the past 15 minutes.
(package private)  long averageLoad5
          load averages for the past 5 minutes.
private static long EXP_1
          1/exp(5sec/1min) as fixed-point
private static long EXP_15
          1/exp(5sec/15min)
private static long EXP_5
          1/exp(5sec/5min)
private static long FIXED_1
          1.0 as fixed-point
private static long FSHIFT
          number of bits of precision
 
Constructor Summary
AverageLoadTask()
           
 
Method Summary
(package private)  long computeLoad(long load, long exp, long n)
           
(package private)  float convert(long average)
           
protected abstract  long countActiveTasks()
           
 float getAverageLoad1()
          Returns the load averages for the last minute.
 float getAverageLoad15()
          Returns the load averages for the past 15 minutes.
 float getAverageLoad5()
          Returns the load averages for the past 5 minutes.
 void run()
           
protected  void start(java.util.Timer timer)
          Starts the resulting task.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FSHIFT

private static long FSHIFT
number of bits of precision


FIXED_1

private static long FIXED_1
1.0 as fixed-point


EXP_1

private static long EXP_1
1/exp(5sec/1min) as fixed-point


EXP_5

private static long EXP_5
1/exp(5sec/5min)


EXP_15

private static long EXP_15
1/exp(5sec/15min)


averageLoad1

long averageLoad1
load averages for the last minute.


averageLoad5

long averageLoad5
load averages for the past 5 minutes.


averageLoad15

long averageLoad15
load averages for the past 15 minutes.

Constructor Detail

AverageLoadTask

public AverageLoadTask()
Method Detail

getAverageLoad1

public float getAverageLoad1()
Returns the load averages for the last minute.

Returns:
the load averages for the last minute.

getAverageLoad5

public float getAverageLoad5()
Returns the load averages for the past 5 minutes.

Returns:
the load averages for the past 5 minutes.

getAverageLoad15

public float getAverageLoad15()
Returns the load averages for the past 15 minutes.

Returns:
the load averages for the past 15 minutes.

convert

float convert(long average)

computeLoad

long computeLoad(long load,
                 long exp,
                 long n)

countActiveTasks

protected abstract long countActiveTasks()

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask
See Also:
TimerTask.run()

start

protected final void start(java.util.Timer timer)
Starts the resulting task.

Parameters:
timer - Timer to use to schedule the resulting task.


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.