sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.call/src/com/nokia/carbide/cpp/pi/call/GfcTrace.java
changeset 5 844b047e260d
parent 2 b9ab3b238396
child 12 ae255c9aa552
equal deleted inserted replaced
4:615035072f7e 5:844b047e260d
    27 import com.nokia.carbide.cpp.internal.pi.model.FunctionResolver;
    27 import com.nokia.carbide.cpp.internal.pi.model.FunctionResolver;
    28 import com.nokia.carbide.cpp.internal.pi.model.GenericSample;
    28 import com.nokia.carbide.cpp.internal.pi.model.GenericSample;
    29 import com.nokia.carbide.cpp.internal.pi.model.GenericSampledTraceWithFunctions;
    29 import com.nokia.carbide.cpp.internal.pi.model.GenericSampledTraceWithFunctions;
    30 import com.nokia.carbide.cpp.internal.pi.utils.QuickSortImpl;
    30 import com.nokia.carbide.cpp.internal.pi.utils.QuickSortImpl;
    31 import com.nokia.carbide.cpp.internal.pi.utils.Sortable;
    31 import com.nokia.carbide.cpp.internal.pi.utils.Sortable;
    32 import com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph;
    32 import com.nokia.carbide.cpp.pi.visual.IGenericTraceGraph;
    33 
    33 
    34 
    34 
    35 public class GfcTrace extends GenericSampledTraceWithFunctions
    35 public class GfcTrace extends GenericSampledTraceWithFunctions
    36 {
    36 {
    37 	private static final long serialVersionUID = -8144591614894549185L;
    37 	private static final long serialVersionUID = -8144591614894549185L;
   204   	    }
   204   	    }
   205   	    
   205   	    
   206   	    CallerCallee caller = new CallerCallee();
   206   	    CallerCallee caller = new CallerCallee();
   207   	    CallerCallee callee = new CallerCallee();
   207   	    CallerCallee callee = new CallerCallee();
   208 
   208 
   209 		if (  (gSam.callerFunctionSym == null || gSam.callerFunctionSym.functionName.endsWith(Messages.getString("GfcTrace.functionNotFound"))) //$NON-NLS-1$
   209 		if (  (gSam.getCallerFunctionSym() == null || gSam.getCallerFunctionSym().getFunctionName().endsWith(Messages.getString("GfcTrace.functionNotFound"))) //$NON-NLS-1$
   210 			&& gSam.callerFunctionItt != null) //$NON-NLS-1$
   210 			&& gSam.getCallerFunctionItt() != null) //$NON-NLS-1$
   211 		{
   211 		{
   212 			caller.functionName = gSam.callerFunctionItt.functionName;
   212 			caller.functionName = gSam.getCallerFunctionItt().getFunctionName();
   213     		caller.startAdress  = gSam.callerFunctionItt.startAddress;
   213     		caller.startAdress  = gSam.getCallerFunctionItt().getStartAddress();
   214 			caller.binaryName   = gSam.callerFunctionItt.functionBinary.binaryName;
   214 			caller.binaryName   = gSam.getCallerFunctionItt().getFunctionBinary().getBinaryName();
   215 			caller.symbolParsed = false;
   215 			caller.symbolParsed = false;
   216 		}
   216 		}
   217 		else
   217 		else
   218 		{
   218 		{
   219 			caller.functionName = gSam.callerFunctionSym.functionName;
   219 			caller.functionName = gSam.getCallerFunctionSym().getFunctionName();
   220 			caller.startAdress  = gSam.callerFunctionSym.startAddress;
   220 			caller.startAdress  = gSam.getCallerFunctionSym().getStartAddress();
   221 			caller.binaryName   = gSam.callerFunctionSym.functionBinary.binaryName;
   221 			caller.binaryName   = gSam.getCallerFunctionSym().getFunctionBinary().getBinaryName();
   222 			caller.symbolParsed = Boolean.valueOf(true);
   222 			caller.symbolParsed = Boolean.valueOf(true);
   223 		}
   223 		}
   224 		
   224 		
   225 		if (   (gSam.currentFunctionSym == null || gSam.currentFunctionSym.functionName.endsWith(Messages.getString("GfcTrace.functionNotFound"))) //$NON-NLS-1$
   225 		if (   (gSam.getCurrentFunctionSym() == null || gSam.getCurrentFunctionSym().getFunctionName().endsWith(Messages.getString("GfcTrace.functionNotFound"))) //$NON-NLS-1$
   226 			&& gSam.currentFunctionItt != null) //$NON-NLS-1$
   226 			&& gSam.getCurrentFunctionItt() != null) //$NON-NLS-1$
   227 		{
   227 		{
   228 			callee.functionName = gSam.currentFunctionItt.functionName;
   228 			callee.functionName = gSam.getCurrentFunctionItt().getFunctionName();
   229     		callee.startAdress  = gSam.currentFunctionItt.startAddress;
   229     		callee.startAdress  = gSam.getCurrentFunctionItt().getStartAddress();
   230 			callee.binaryName   = gSam.currentFunctionItt.functionBinary.binaryName;
   230 			callee.binaryName   = gSam.getCurrentFunctionItt().getFunctionBinary().getBinaryName();
   231 			callee.symbolParsed = Boolean.valueOf(false);
   231 			callee.symbolParsed = Boolean.valueOf(false);
   232 		}
   232 		}
   233 		else
   233 		else
   234 		{
   234 		{
   235 			callee.functionName = gSam.currentFunctionSym.functionName;
   235 			callee.functionName = gSam.getCurrentFunctionSym().getFunctionName();
   236     		callee.startAdress  = gSam.currentFunctionSym.startAddress;
   236     		callee.startAdress  = gSam.getCurrentFunctionSym().getStartAddress();
   237 			callee.binaryName   = gSam.currentFunctionSym.functionBinary.binaryName;
   237 			callee.binaryName   = gSam.getCurrentFunctionSym().getFunctionBinary().getBinaryName();
   238 			callee.symbolParsed = Boolean.valueOf(true);
   238 			callee.symbolParsed = Boolean.valueOf(true);
   239 		}
   239 		}
   240 
   240 
   241 		this.updateEntryLists(sample, programCounter, linkRegister, caller, callee);
   241 		this.updateEntryLists(sample, programCounter, linkRegister, caller, callee);
   242   	}
   242   	}
   282 	    	this.parsedGfcTrace.put(callerStart, caller);
   282 	    	this.parsedGfcTrace.put(callerStart, caller);
   283 	    }
   283 	    }
   284 
   284 
   285 	    if (!caller.equals(callee))
   285 	    if (!caller.equals(callee))
   286 	    {
   286 	    {
   287 	    	callee.addCaller(caller, new Integer((int)sample));
   287 	    	callee.addCaller(caller, Integer.valueOf((int)sample));
   288 	    	caller.addCallee(callee, new Integer((int)sample));
   288 	    	caller.addCallee(callee, Integer.valueOf((int)sample));
   289 	    }
   289 	    }
   290 	}
   290 	}
   291   
   291   
   292 	public void countRecursiveLoad()
   292 	public void countRecursiveLoad()
   293 	{
   293 	{
   457 	  	int i = 0;
   457 	  	int i = 0;
   458 	  	while (elements.hasMoreElements())
   458 	  	while (elements.hasMoreElements())
   459 	  	{
   459 	  	{
   460 	  		ItemSorter is = (ItemSorter)elements.nextElement();
   460 	  		ItemSorter is = (ItemSorter)elements.nextElement();
   461 	  		f[i++] = is.item;
   461 	  		f[i++] = is.item;
   462 	  		this.parsedGfcTrace.put(new Long(is.item.address), is.item);
   462 	  		this.parsedGfcTrace.put(Long.valueOf(is.item.address), is.item);
   463 	  	}
   463 	  	}
   464   	
   464   	
   465 	  	return f;
   465 	  	return f;
   466 	}
   466 	}
   467   
   467   
   516   				this.completeSamples = false;
   516   				this.completeSamples = false;
   517   				break;
   517   				break;
   518   			}
   518   			}
   519   		}
   519   		}
   520   	}
   520   	}
   521   	
   521   		
   522   	// this method is not used
       
   523   	public GenericTraceGraph getTraceGraph()
       
   524   	{
       
   525   		return null;
       
   526   	}
       
   527 
       
   528   	// this method is not used
       
   529   	public GenericTraceGraph getTraceGraph(int graphNumber)
       
   530   	{
       
   531 		return null;
       
   532 	}
       
   533 	
       
   534 	public CallVisualiser getCallVisualiser()
   522 	public CallVisualiser getCallVisualiser()
   535 	{
   523 	{
   536 		return this.callVisualiser;
   524 		return this.callVisualiser;
   537 	}
   525 	}
   538 	
   526 	
   554 	public Vector getCompleteGfcTrace()
   542 	public Vector getCompleteGfcTrace()
   555 	{
   543 	{
   556 		return this.completeGfcTrace;
   544 		return this.completeGfcTrace;
   557 	}
   545 	}
   558 
   546 
   559 	@Override
       
   560 	public void finalizeTrace()
       
   561 	{
       
   562 		for (int i = 0; i < samples.size(); i++) {
       
   563 			GfcSample sample = (GfcSample) samples.get(i);
       
   564 			
       
   565 			if (sample.currentFunctionItt == null && sample.currentFunctionSym == null) {
       
   566 				sample.currentFunctionItt = new Function(Messages.getString("GfcTrace.functionNotFound1") + Long.toHexString(sample.programCounter) + Messages.getString("GfcTrace.functionNotFound2"), //$NON-NLS-1$ //$NON-NLS-2$
       
   567 						new Long(sample.programCounter),
       
   568 						Messages.getString("GfcTrace.binaryNotFound1") +  Long.toHexString(sample.programCounter) + Messages.getString("GfcTrace.binaryNotFound2")); //$NON-NLS-1$ //$NON-NLS-2$
       
   569 			}
       
   570 			
       
   571 			if (sample.callerFunctionItt == null && sample.callerFunctionSym == null) {
       
   572 				sample.callerFunctionItt = new Function(Messages.getString("GfcTrace.functionNotFound1") + Long.toHexString(sample.linkRegister) + Messages.getString("GfcTrace.functionNotFound2"), //$NON-NLS-1$ //$NON-NLS-2$
       
   573 						new Long(sample.linkRegister),
       
   574 						Messages.getString("GfcTrace.binaryNotFound1") +  Long.toHexString(sample.linkRegister) + Messages.getString("GfcTrace.binaryNotFound2")); //$NON-NLS-1$ //$NON-NLS-2$
       
   575 			}
       
   576 		}
       
   577 	}
       
   578 }
   547 }