com.oy.shared.lw.perf.agent
Class PerfAgent

java.lang.Object
  extended bycom.oy.shared.lw.perf.agent.PerfAgent
All Implemented Interfaces:
IPerfAgent

public class PerfAgent
extends java.lang.Object
implements IPerfAgent


Nested Class Summary
(package private)  class PerfAgent.PerfMonitorStub
           
(package private)  class PerfAgent.ServerThread
           
 
Nested classes inherited from class com.oy.shared.lw.perf.IPerfAgent
IPerfAgent.MockPerfAgent
 
Field Summary
private  java.lang.StringBuffer m_Buffer
           
private  int m_Collect
           
private  PerfAgentContext m_Ctx
           
private static java.text.SimpleDateFormat m_DateFormat
           
private  java.util.List m_History
           
private  long m_LastSnapshot
           
private  java.util.Set m_Listeners
           
private  java.util.List m_Monitors
           
private static java.text.NumberFormat m_NumFormat
           
private  java.lang.String m_OldPerf
           
private  int m_Sequence
           
private  PerfAgent.ServerThread m_Thread
           
private  ITrace m_Trace
           
 
Constructor Summary
PerfAgent(ITrace trace, PerfAgentContext ctx)
           
PerfAgent(PerfAgentContext ctx)
           
 
Method Summary
 void addListener(IPerfAgentListener listener)
           
 void addMonitor(IPerfMonitor monitor)
          wehn we add monitor we might have a stub for it when it wasremoved last; in this case we need to replace stub with real monitor; this is done so the position of a collected value in the history row does not change
protected  void afterAddMonitor(IPerfMonitor monitor)
           
protected  void afterRemoveMonitor(IPerfMonitor monitor)
           
private  void assertValidMonitor(IPerfMonitor monitor)
           
private  void collectNow()
           
 IPerfMonitor[] enumMonitors()
           
private  int indexOfName(IPerfMonitor monitor)
           
 void makeSnapshot(java.lang.StringBuffer sb)
           
 void makeSnapshot(java.lang.StringBuffer sb, int maxItems)
           
 void removeListener(IPerfAgentListener listener)
           
 void removeMonitor(IPerfMonitor monitor)
          when we remove monitors will keep a stub object instead; this is done so the position of a collected value in the history row does not change
private  void renderDataRows(java.lang.StringBuffer sb, HtmlSnapshotFormatter form, int maxItems)
           
private  void renderHeaderRow(java.lang.StringBuffer sb, HtmlSnapshotFormatter form)
           
private  void renderValues(java.lang.StringBuffer sb, int count, long[] values)
           
private  void snapshotNow()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_NumFormat

private static java.text.NumberFormat m_NumFormat

m_DateFormat

private static java.text.SimpleDateFormat m_DateFormat

m_Listeners

private java.util.Set m_Listeners

m_Monitors

private java.util.List m_Monitors

m_History

private java.util.List m_History

m_Buffer

private java.lang.StringBuffer m_Buffer

m_Sequence

private int m_Sequence

m_Collect

private int m_Collect

m_OldPerf

private java.lang.String m_OldPerf

m_LastSnapshot

private long m_LastSnapshot

m_Thread

private PerfAgent.ServerThread m_Thread

m_Trace

private ITrace m_Trace

m_Ctx

private PerfAgentContext m_Ctx
Constructor Detail

PerfAgent

public PerfAgent(PerfAgentContext ctx)
          throws java.lang.Exception

PerfAgent

public PerfAgent(ITrace trace,
                 PerfAgentContext ctx)
          throws java.lang.Exception
Method Detail

stop

public void stop()

addListener

public void addListener(IPerfAgentListener listener)
Specified by:
addListener in interface IPerfAgent

removeListener

public void removeListener(IPerfAgentListener listener)
Specified by:
removeListener in interface IPerfAgent

renderHeaderRow

private void renderHeaderRow(java.lang.StringBuffer sb,
                             HtmlSnapshotFormatter form)

renderDataRows

private void renderDataRows(java.lang.StringBuffer sb,
                            HtmlSnapshotFormatter form,
                            int maxItems)

makeSnapshot

public void makeSnapshot(java.lang.StringBuffer sb)
Specified by:
makeSnapshot in interface IPerfAgent

makeSnapshot

public void makeSnapshot(java.lang.StringBuffer sb,
                         int maxItems)
Specified by:
makeSnapshot in interface IPerfAgent

assertValidMonitor

private void assertValidMonitor(IPerfMonitor monitor)

indexOfName

private int indexOfName(IPerfMonitor monitor)

addMonitor

public void addMonitor(IPerfMonitor monitor)
wehn we add monitor we might have a stub for it when it wasremoved last; in this case we need to replace stub with real monitor; this is done so the position of a collected value in the history row does not change

Specified by:
addMonitor in interface IPerfAgent

removeMonitor

public void removeMonitor(IPerfMonitor monitor)
when we remove monitors will keep a stub object instead; this is done so the position of a collected value in the history row does not change

Specified by:
removeMonitor in interface IPerfAgent

renderValues

private void renderValues(java.lang.StringBuffer sb,
                          int count,
                          long[] values)

snapshotNow

private void snapshotNow()

collectNow

private void collectNow()

enumMonitors

public IPerfMonitor[] enumMonitors()
Specified by:
enumMonitors in interface IPerfAgent

afterAddMonitor

protected void afterAddMonitor(IPerfMonitor monitor)

afterRemoveMonitor

protected void afterRemoveMonitor(IPerfMonitor monitor)


Copyright (C) 2005-2006 Pavel Simakov
http://www.softwaresecretweapons.com