sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.irq/src/com/nokia/carbide/cpp/pi/irq/IrqTraceParser.java
changeset 12 ae255c9aa552
parent 5 844b047e260d
equal deleted inserted replaced
11:5b9d4d8641ce 12:ae255c9aa552
    31 public class IrqTraceParser extends Parser
    31 public class IrqTraceParser extends Parser
    32 {
    32 {
    33 //  private String profilerVersion;
    33 //  private String profilerVersion;
    34   private Vector completeIrqTrace;
    34   private Vector completeIrqTrace;
    35   private int firstSample,lastSample;
    35   private int firstSample,lastSample;
    36   private long old_1 = 0;
    36   private long old1 = 0;
    37   private long old_2 = 0;
    37   private long old2 = 0;
    38   private long old_3 = 0;
    38   private long old3 = 0;
    39   private int sampleNum = 0;
    39   private int sampleNum = 0;
    40   private int old_irq_lev1 = 0;
    40   private int oldIrqLev1 = 0;
    41   private int old_irq_lev2 = 0;
    41   private int oldIrqLev2 = 0;
    42     
    42     
    43   public IrqTraceParser(/*File irqFile, ProgressBar progressBar*/) throws Exception
    43   public IrqTraceParser(/*File irqFile, ProgressBar progressBar*/) throws Exception
    44   {
    44   {
    45     this.completeIrqTrace = new Vector();
    45     this.completeIrqTrace = new Vector();
    46   }
    46   }
   266   	  			
   266   	  			
   267   	  			length-=3;read+=3;
   267   	  			length-=3;read+=3;
   268   	  			
   268   	  			
   269   	  			if(length > 0)
   269   	  			if(length > 0)
   270   	  			{
   270   	  			{
   271   	  				this.old_irq_lev1 = dis.readUnsignedByte();
   271   	  				this.oldIrqLev1 = dis.readUnsignedByte();
   272   	  				this.old_irq_lev2 = dis.readUnsignedByte();
   272   	  				this.oldIrqLev2 = dis.readUnsignedByte();
   273   	  				length-=2; read-=2;
   273   	  				length-=2; read-=2;
   274 
   274 
   275   	  				this.addIrqSample();
   275   	  				this.addIrqSample();
   276   	  			}
   276   	  			}
   277   	  		}
   277   	  		}
   278   	  		else
   278   	  		else
   279   	  		{
   279   	  		{
   280   	  			this.old_irq_lev1 = firstByte;
   280   	  			this.oldIrqLev1 = firstByte;
   281   	  			this.old_irq_lev2 = dis.readUnsignedByte();
   281   	  			this.oldIrqLev2 = dis.readUnsignedByte();
   282   	  			length--;read++;
   282   	  			length--;read++;
   283 
   283 
   284   	  			this.addIrqSample();
   284   	  			this.addIrqSample();
   285   	  		}
   285   	  		}
   286   	  		
   286   	  		
   337 			fValue |= value;
   337 			fValue |= value;
   338 			//System.out.println("v"+i+":"+Integer.toHexString(value));
   338 			//System.out.println("v"+i+":"+Integer.toHexString(value));
   339 		}
   339 		}
   340 	}
   340 	}
   341 	//if(fValue == -1) System.out.println("1:"+fValue); 	
   341 	//if(fValue == -1) System.out.println("1:"+fValue); 	
   342 	this.old_1 += fValue;
   342 	this.old1 += fValue;
   343 
   343 
   344 	value = 0;
   344 	value = 0;
   345 	fValue = 0;
   345 	fValue = 0;
   346 	neg = false;
   346 	neg = false;
   347 	for(int i=0;i<4;i++)
   347 	for(int i=0;i<4;i++)
   363 			fValue |= value;
   363 			fValue |= value;
   364 			//System.out.println("v"+i+":"+Integer.toHexString(value));
   364 			//System.out.println("v"+i+":"+Integer.toHexString(value));
   365 		}
   365 		}
   366 	}
   366 	}
   367 	//if(fValue == -1) System.out.println("2:"+fValue); 	
   367 	//if(fValue == -1) System.out.println("2:"+fValue); 	
   368 	this.old_2 += fValue;
   368 	this.old2 += fValue;
   369 	
   369 	
   370 	value = 0;
   370 	value = 0;
   371 	fValue = 0;
   371 	fValue = 0;
   372 	neg = false;
   372 	neg = false;
   373 	for(int i=0;i<4;i++) 
   373 	for(int i=0;i<4;i++) 
   389 			fValue |= value;
   389 			fValue |= value;
   390 			//System.out.println("v"+i+":"+Integer.toHexString(value));
   390 			//System.out.println("v"+i+":"+Integer.toHexString(value));
   391 		}
   391 		}
   392 	}
   392 	}
   393 	//if(fValue == -1) System.out.println("3:"+fValue); 	
   393 	//if(fValue == -1) System.out.println("3:"+fValue); 	
   394 	this.old_3 += fValue;
   394 	this.old3 += fValue;
   395 	
   395 	
   396 	this.addSwiSample();
   396 	this.addSwiSample();
   397 	/*
   397 	/*
   398 	System.out.println( "#"+this.sampleNum+" "+Integer.toHexString((int)old_1)+
   398 	System.out.println( "#"+this.sampleNum+" "+Integer.toHexString((int)old_1)+
   399 						" "+Integer.toHexString((int)old_2)+
   399 						" "+Integer.toHexString((int)old_2)+
   402  	return;
   402  	return;
   403   }
   403   }
   404   
   404   
   405   private void addSwiSample()
   405   private void addSwiSample()
   406   {
   406   {
   407 	  long temp_1 = ((this.old_1 << 32) >>> 32);
   407 	  long temp_1 = ((this.old1 << 32) >>> 32);
   408 	  long temp_2 = ((this.old_2 << 32) >>> 32);
   408 	  long temp_2 = ((this.old2 << 32) >>> 32);
   409 	  long temp_3 = ((this.old_3 << 32) >>> 32)-4;
   409 	  long temp_3 = ((this.old3 << 32) >>> 32)-4;
   410 	  
   410 	  
   411 	  IrqSample sample = new IrqSample(this.sampleNum, temp_1, temp_2, temp_3);
   411 	  IrqSample sample = new IrqSample(this.sampleNum, temp_1, temp_2, temp_3);
   412 	  /*
   412 	  /*
   413 	  String n1 = sfp.getFunctionNameForAddress(temp_3);
   413 	  String n1 = sfp.getFunctionNameForAddress(temp_3);
   414 	  
   414 	  
   431 	  this.completeIrqTrace.add(sample);
   431 	  this.completeIrqTrace.add(sample);
   432   }
   432   }
   433   
   433   
   434   private void addSwiRepeat(int amount)
   434   private void addSwiRepeat(int amount)
   435   {
   435   {
   436 	  long temp_1 = ((this.old_1 << 32) >>> 32);
   436 	  long temp_1 = ((this.old1 << 32) >>> 32);
   437 	  long temp_2 = ((this.old_2 << 32) >>> 32);
   437 	  long temp_2 = ((this.old2 << 32) >>> 32);
   438 	  long temp_3 = ((this.old_3 << 32) >>> 32)-4;
   438 	  long temp_3 = ((this.old3 << 32) >>> 32)-4;
   439 	  
   439 	  
   440 	  /*
   440 	  /*
   441 	  String n1 = sfp.getFunctionNameForAddress(temp_3);
   441 	  String n1 = sfp.getFunctionNameForAddress(temp_3);
   442 	  
   442 	  
   443 	  if(n1.indexOf("WaitForAnyRequest") != -1)
   443 	  if(n1.indexOf("WaitForAnyRequest") != -1)
   462 	  this.completeIrqTrace.add(sample);
   462 	  this.completeIrqTrace.add(sample);
   463   }
   463   }
   464 
   464 
   465   private void addIrqSample()
   465   private void addIrqSample()
   466   {
   466   {
   467   	IrqSample sample = new IrqSample(this.sampleNum,this.old_irq_lev1,this.old_irq_lev2);
   467   	IrqSample sample = new IrqSample(this.sampleNum,this.oldIrqLev1,this.oldIrqLev2);
   468   	this.completeIrqTrace.add(sample);
   468   	this.completeIrqTrace.add(sample);
   469   }
   469   }
   470   
   470   
   471   private void addIrqRepeat(int amount)
   471   private void addIrqRepeat(int amount)
   472   {
   472   {
   473   	  	IrqSample sample = new IrqSample(this.sampleNum,this.old_irq_lev1,this.old_irq_lev2);
   473   	  	IrqSample sample = new IrqSample(this.sampleNum,this.oldIrqLev1,this.oldIrqLev2);
   474   	  	sample.repeatCount = amount; 
   474   	  	sample.repeatCount = amount; 
   475  	  	this.completeIrqTrace.add(sample);
   475  	  	this.completeIrqTrace.add(sample);
   476   }
   476   }
   477   
   477   
   478   private GenericTrace getTrace()
   478   private GenericTrace getTrace()