org.w3c.jigsaw.http
Class httpdStatistics

java.lang.Object
  extended by org.w3c.jigsaw.http.httpdStatistics

public class httpdStatistics
extends java.lang.Object

This class maintains server wide statistics about hits. This class should probably be coded as a resource itself, and made accessible through a specific HTTPResource. I am just having fun for the time being.


Field Summary
protected  SocketClientFactoryStats factoryStats
           
protected  boolean init
           
protected  long r_max
          The maximum processing time in ms.
protected  long r_min
          The min processing time in ms.
protected  long rd_max
          The maximum processing time in ms for dynamic content
protected  long rd_min
          The min processing time in ms for dynamic content
protected  httpd server
           
protected  long start_time
          The date at which the server was started (ms since Java epoch).
protected  long t_bytes
          The total number of emited bytes.
protected  long t_hits
          The total number of hits.
protected  long t_req
          The total time spent in processing requests in ms.
protected  long td_bytes
          The total number of emited bytes for dynamic content
protected  long td_hits
          The total number of hits for dynamic content
protected  long td_req
          The total time spent in processing requests in ms for dynamic content
protected  java.net.URL u_max
          The URL that has been processed the slowest.
protected  java.net.URL u_min
          The URL that has been processed the fastest.
protected  java.net.URL ud_max
          The URL that has been processed the slowest for dynamic content
protected  java.net.URL ud_min
          The URL that has been processed the fastest for dynamic content
 
Method Summary
 long getDynamicHitCount()
          Get the total number of hits for dynamic content.
 long getEmittedBytes()
          Get the total number of bytes emited.
 int getFreeThreadCount()
          Get the number of free threads in the server.
 long getHitCount()
          Get the total number of hits.
 int getIdleThreadCount()
          Get the number of idle threads in the server.
 long getMaxDynamicRequestTime()
          Get the max request processing time for dynamic content
 long getMaxRequestTime()
          Get the max request processing time.
 java.net.URL getMaxRequestURL()
          Get the URL of the request that took the longest time to be processed.
 long getMaxStaticRequestTime()
          Get the max request processing time for static content
 long getMeanDynamicRequestTime()
          Get the mean request processing time for dynamic content
 long getMeanRequestTime()
          Get the mean request processing time.
 long getMeanStaticRequestTime()
          Get the mean request processing time.
 long getMinDynamicRequestTime()
          Get the min request processing time for dynamic content
 long getMinRequestTime()
          Get the min request processing time.
 java.net.URL getMinRequestURL()
          Get the URL of the request that took the smallest time to be processed.
 long getMinStaticRequestTime()
          Get the min request processing time.
 int getServerLoad()
          Get the current server load.
 long getStartTime()
          Get the time at which the server was started.
 long getStaticHitCount()
          Get the total number of hits for static content.
 int getTotalThreadCount()
          Get the total number of client threads.
protected  void updateStatistics(Client client, Request request, Reply reply, int nbytes, long duration)
          Update the current statistics with the given request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected httpd server

r_min

protected long r_min
The min processing time in ms.


rd_min

protected long rd_min
The min processing time in ms for dynamic content


u_min

protected java.net.URL u_min
The URL that has been processed the fastest.


ud_min

protected java.net.URL ud_min
The URL that has been processed the fastest for dynamic content


r_max

protected long r_max
The maximum processing time in ms.


rd_max

protected long rd_max
The maximum processing time in ms for dynamic content


u_max

protected java.net.URL u_max
The URL that has been processed the slowest.


ud_max

protected java.net.URL ud_max
The URL that has been processed the slowest for dynamic content


t_hits

protected long t_hits
The total number of hits.


td_hits

protected long td_hits
The total number of hits for dynamic content


t_bytes

protected long t_bytes
The total number of emited bytes.


td_bytes

protected long td_bytes
The total number of emited bytes for dynamic content


t_req

protected long t_req
The total time spent in processing requests in ms.


td_req

protected long td_req
The total time spent in processing requests in ms for dynamic content


start_time

protected long start_time
The date at which the server was started (ms since Java epoch).


factoryStats

protected SocketClientFactoryStats factoryStats

init

protected boolean init
Method Detail

updateStatistics

protected void updateStatistics(Client client,
                                Request request,
                                Reply reply,
                                int nbytes,
                                long duration)
Update the current statistics with the given request.

Parameters:
client - The client that processed the request.
request - The request that has been processed.
nbytes - The number of emited bytes in reply's body.
duration - The processing time of the request.

getServerLoad

public int getServerLoad()
Get the current server load.

Returns:
A number between 1 and 4.

getFreeThreadCount

public int getFreeThreadCount()
Get the number of free threads in the server.

Returns:
The number of threads ready to server client requests.

getIdleThreadCount

public int getIdleThreadCount()
Get the number of idle threads in the server. Idle threads are the threads ready to accept more requests on a given connection.

Returns:
The number of idle threads.

getTotalThreadCount

public int getTotalThreadCount()
Get the total number of client threads.

Returns:
The total number of created threads.

getHitCount

public long getHitCount()
Get the total number of hits.

Returns:
The total number of processed requests since the server is up.

getDynamicHitCount

public long getDynamicHitCount()
Get the total number of hits for dynamic content.

Returns:
The total number of processed requests since the server is up.

getStaticHitCount

public long getStaticHitCount()
Get the total number of hits for static content.

Returns:
The total number of processed requests since the server is up.

getMeanRequestTime

public long getMeanRequestTime()
Get the mean request processing time.

Returns:
The average time to process a request.

getMeanDynamicRequestTime

public long getMeanDynamicRequestTime()
Get the mean request processing time for dynamic content

Returns:
The average time to process a request.

getMeanStaticRequestTime

public long getMeanStaticRequestTime()
Get the mean request processing time.

Returns:
The average time to process a request.

getMaxRequestTime

public long getMaxRequestTime()
Get the max request processing time.

Returns:
A long giving the maximum duration for a request.

getMaxDynamicRequestTime

public long getMaxDynamicRequestTime()
Get the max request processing time for dynamic content

Returns:
A long giving the maximum duration for a request.

getMaxStaticRequestTime

public long getMaxStaticRequestTime()
Get the max request processing time for static content

Returns:
A long giving the maximum duration for a request.

getMaxRequestURL

public java.net.URL getMaxRequestURL()
Get the URL of the request that took the longest time to be processed.

Returns:
A String giving the URL of the corresponding request, or null if no request has been processed yet.

getMinRequestTime

public long getMinRequestTime()
Get the min request processing time.

Returns:
A long giving the minimum request processing time.

getMinDynamicRequestTime

public long getMinDynamicRequestTime()
Get the min request processing time for dynamic content

Returns:
A long giving the minimum request processing time.

getMinStaticRequestTime

public long getMinStaticRequestTime()
Get the min request processing time.

Returns:
A long giving the minimum request processing time.

getMinRequestURL

public java.net.URL getMinRequestURL()
Get the URL of the request that took the smallest time to be processed.

Returns:
A String giving the URL of the corresponding request, or null if no request has been processed yet.

getEmittedBytes

public long getEmittedBytes()
Get the total number of bytes emited.

Returns:
A long giving the total number of bytes emited by the server. This count that not include the reply's header, but only the reply's body (or entity size).

getStartTime

public long getStartTime()
Get the time at which the server was started.

Returns:
A number of milliseconds since java epoch, giving the date at which the server started.