FileDocCategorySizeDatePackage
ProfileCalleeAggregate.javaAPI DocExample4712Mon Dec 28 21:46:30 GMT 1998tuning.profview

ProfileCalleeAggregate

public class ProfileCalleeAggregate extends Object
This class was generated by a SmartGuide.

Fields Summary
int
time
int
diffTime
int
count
ProfileMethod
callee
Hashtable
callers
ProfileCallerAggregate[]
aggs
Constructors Summary
public ProfileCalleeAggregate(ProfileLine line)
This method was created by a SmartGuide.

param
callee jack.profiler.ProfileMethod

	count = line.count;
	time = line.time;
	callee = line.callee;
	ProfileCallerAggregate caller;
	callers = new java.util.Hashtable();
	caller = new ProfileCallerAggregate(line);
	callers.put(line.caller.method, caller);
Methods Summary
public voidadd(ProfileLine line)
This method was created by a SmartGuide.

	count += line.count;
	time += line.time;
	ProfileCallerAggregate caller;
	if ( (caller = (ProfileCallerAggregate) callers.get(line.caller.method)) == null)
	{
		caller = new ProfileCallerAggregate(line);
		callers.put(line.caller.method, caller);
	}
	else
		caller.add(line);
public voidaggregationIsFinished()
This method was created by a SmartGuide.

    diffTime = time;
	aggs = new ProfileCallerAggregate[callers.size()];
	int idx = 0;
	java.util.Enumeration e = callers.elements();
	while (e.hasMoreElements())
	{
		aggs[idx] =  (ProfileCallerAggregate) e.nextElement();
		idx++;
	}
	callers = null;
public voidappendTo(java.lang.StringBuffer s, boolean timeFirst)
This method was created by a SmartGuide.

param
s java.lang.StringBuffer

	String lf = System.getProperty("line.separator");
	s.append(timeFirst ? time : count).append("\t").append(timeFirst ? count : time).append("\t").append(diffTime).append("\t");
	callee.appendTo(s);
	s.append(lf).append("\tCalled by").append(lf).append("\t%\t");
	s.append(timeFirst ? "time\tcount" : "count\ttime").append("\tcaller");
	for (int i = aggs.length-1; i >= 0 ; i--)
	{
		s.append(lf).append("\t");
		if (timeFirst)
			ProfileStack.appendPercent(s,aggs[i].time,time);
		else
			ProfileStack.appendPercent(s,aggs[i].count,count);
		s.append('\t");
		aggs[i].appendTo(s,timeFirst);
	}
voidsortAggOnCount(int lo, int hi)
This method was created by a SmartGuide.

	if( lo >= hi ) 
		return;

	int mid = ( lo + hi ) / 2;
	ProfileCallerAggregate tmp;
	ProfileCallerAggregate middle = aggs[ mid ];

	if( aggs[ lo ].count > middle.count)
	{
		aggs[ mid ] = aggs[ lo ];
		aggs[ lo ] = middle;
		middle = aggs[ mid ];
	}

	if( middle.count > aggs[hi].count)
	{
		aggs[ mid ] = aggs[ hi ];
		aggs[ hi ] = middle;
		middle = aggs[ mid ];

		if( aggs[ lo ].count > middle.count)
		{
			aggs[ mid ] = aggs[ lo ];
			aggs[ lo ] = middle;
			middle = aggs[ mid ];
		}
	}

	int left = lo + 1;
	int right = hi - 1;

	if( left >= right ) 
		return;

	for( ;; ) 
	{
		while( aggs[ right ].count >  middle.count)
		{
			right--;
		}

		while( left < right && aggs[ left ].count <= middle.count)
		{
			left++;
		}

		if( left < right )
		{
			tmp = aggs[ left ];
			aggs[ left ] = aggs[ right ];
			aggs[ right ] = tmp;
			right--;
		}
		else
		{
			break;
		}
	}

	sortAggOnCount(lo, left);
	sortAggOnCount(left + 1, hi);
voidsortAggOnTime(int lo, int hi)
This method was created by a SmartGuide.

	if( lo >= hi ) 
		return;

	int mid = ( lo + hi ) / 2;
	ProfileCallerAggregate tmp;
	ProfileCallerAggregate middle = aggs[ mid ];

	if( aggs[ lo ].time > middle.time)
	{
		aggs[ mid ] = aggs[ lo ];
		aggs[ lo ] = middle;
		middle = aggs[ mid ];
	}

	if( middle.time > aggs[hi].time)
	{
		aggs[ mid ] = aggs[ hi ];
		aggs[ hi ] = middle;
		middle = aggs[ mid ];

		if( aggs[ lo ].time > middle.time)
		{
			aggs[ mid ] = aggs[ lo ];
			aggs[ lo ] = middle;
			middle = aggs[ mid ];
		}
	}

	int left = lo + 1;
	int right = hi - 1;

	if( left >= right ) 
		return;

	for( ;; ) 
	{
		while( aggs[ right ].time >  middle.time)
		{
			right--;
		}

		while( left < right && aggs[ left ].time <= middle.time)
		{
			left++;
		}

		if( left < right )
		{
			tmp = aggs[ left ];
			aggs[ left ] = aggs[ right ];
			aggs[ right ] = tmp;
			right--;
		}
		else
		{
			break;
		}
	}

	sortAggOnTime(lo, left);
	sortAggOnTime(left + 1, hi);
public voidsortOnCount()
This method was created by a SmartGuide.

	sortAggOnCount(0,aggs.length - 1);
public voidsortOnTime()
This method was created by a SmartGuide.

	sortAggOnTime(0,aggs.length - 1);
public java.lang.StringtoString()

    StringBuffer s = new StringBuffer();
    appendTo(s,false);
    return s.toString();