Methods Summary |
---|
public void | add(java.lang.String checkpointName, long nanoseconds)
synchronized( mCheckpointNames )
{
mCheckpointNames.add( checkpointName );
mCheckpointTimes.add( nanoseconds );
}
|
public void | add(java.lang.String checkpointName, TimingDelta delta)Convenience--same as add( checkpoint, delta.elapsed() ) ;
add( checkpointName, delta.elapsed() );
|
public void | clear()Remove all timings.
synchronized( mCheckpointNames )
{
mCheckpointNames.clear();
}
|
public static com.sun.appserv.management.util.misc.Timings | getInstance()Get the default Timings object. No synchronization happens or is needed; fast.
return INSTANCE;
|
public static com.sun.appserv.management.util.misc.Timings | getInstance(java.lang.String name)Get a named Timings object. Synchronization happens in this call, to access a Map.
Timings timings = null;
synchronized( sInstances )
{
timings = sInstances.get( name );
if ( timings == null )
{
timings = newInstance( name );
sInstances.put( name, timings );
}
}
return timings;
|
public java.lang.String | getName()
return mName;
|
public static com.sun.appserv.management.util.misc.Timings | newInstance(java.lang.String name)Create a Timings object. It is not retained in the list of Timings instances.
return new Timings( name );
|
public static void | removeInstance(java.lang.String name)
synchronized( sInstances )
{
sInstances.remove( name );
}
|
public java.lang.String | toString()
final StringBuffer buf = new StringBuffer();
buf.append( "Timing Log " );
buf.append( StringUtil.quote( getName() ) );
buf.append( NEWLINE );
final List<String> names = new ArrayList<String>();
final List<Long> times = new ArrayList<Long>();
synchronized( mCheckpointNames )
{
names.addAll( mCheckpointNames );
times.addAll( mCheckpointTimes );
}
for( int i = 0; i < names.size(); ++i )
{
final String name = names.get(i);
final long nanos = times.get(i);
buf.append( name );
buf.append( " = " );
buf.append( StringUtil.getMillisString( nanos ) );
buf.append( NEWLINE );
}
return buf.toString();
|