com.dallaway.sloppy
Class Usage

java.lang.Object
  |
  +--com.dallaway.sloppy.Usage

public class Usage
extends java.lang.Object

Records the bandwidth usage for a given client.

Note that if a user does not make a request for 5 seconds, this data is considered stale and is reset. We do this because we use timestamp of first request and total bytes transferred as measures to keep BPS low. If a user goes away for a few hours, it may suddenly look as if they have had very low bandwidth usage (= bytes / total time). If the user is doing nothing, bytes is constant and total time increases until they have effectively unlimited bandwidth. So we reset bytes and total time if the user goes quite for 5 seconds or longer.


Constructor Summary
Usage()
           
 
Method Summary
 long getStartTime()
           
 int getTotalBytes()
           
 void increment(int n)
          Note that the client has exchanged some data
 void mark()
          Note that a data exchange event has occured
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Usage

public Usage()
Method Detail

increment

public void increment(int n)
Note that the client has exchanged some data
Parameters:
bytes - The number of bytes exchanged

mark

public void mark()
Note that a data exchange event has occured

getStartTime

public long getStartTime()
Returns:
start_time The time of the first data exchange event

getTotalBytes

public int getTotalBytes()
Returns:
total_bytes Total bytes exchanged to date