edu.jhu.cnds.Frugal
Class LoadTester

java.lang.Object
  |
  +--edu.jhu.cnds.Frugal.LoadTester

public class LoadTester
extends java.lang.Object
implements java.lang.Runnable

A load testing application, capable of abstractly measuring a system's load and speed.

Version:
2.0
Author:
R. Sean Borgstrom

Field Summary
protected static long maxspeed
          Maximum speed (in arithmetic operations per second) experienced during testing.
protected static long minspeed
          Minimum speed (in arithmetic operations per second) experienced during testing.
 
Constructor Summary
LoadTester()
          Constructs a new load tester implementation.
 
Method Summary
static long currentFreeMemory()
          Returns the free memory on a system.
static long currentSpeed()
          Returns the most recent speed measurement.
static long currentUsedMemory()
          Returns the used memory on a system.
static void main(java.lang.String[] argv)
          Starts the load tester running.
 void run()
          Starts computing the system's speed.
static long totalMemory()
          Returns the total memory on a system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxspeed

protected static long maxspeed
Maximum speed (in arithmetic operations per second) experienced during testing. The current load is equal to (maximum speed) / (current speed).

minspeed

protected static long minspeed
Minimum speed (in arithmetic operations per second) experienced during testing. The highest load yet seen is equal to (maximum speed) / (minimum speed). To provide additional fault tolerance, if the minimum speed is less than currentSpeed / 64, we reset the minimum speed to currentSpeed. This avoids errors potentially created by machine failure during testing.
Constructor Detail

LoadTester

public LoadTester()
           throws java.rmi.RemoteException
Constructs a new load tester implementation.
Method Detail

totalMemory

public static long totalMemory()
Returns the total memory on a system.
Returns:
Total memory assigned to the tested virtual machine, as returned by Runtime.getRuntime().totalMemory()

currentFreeMemory

public static long currentFreeMemory()
Returns the free memory on a system.
Returns:
Free memory on the tested virtual machine, as returned by Runtime.getRuntime.freeMemory()

currentUsedMemory

public static long currentUsedMemory()
Returns the used memory on a system.
Returns:
Currently used memory on the tested virtual machine (total memory minus free memory, as returned by Runtime.getRuntime().totalMemory() and freeMemory().)

currentSpeed

public static long currentSpeed()
Returns the most recent speed measurement.
Returns:
The number of calculations performed during a 1-second test repeated every 30 seconds, or a similar measure of CPU Speed. A high load reduces this speed.

run

public void run()
Starts computing the system's speed.
Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] argv)
Starts the load tester running.
Parameters:
argv - Command-line style arguments, presumably null.