63 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository; |
63 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository; |
64 import com.nokia.carbide.cpp.internal.pi.model.Function; |
64 import com.nokia.carbide.cpp.internal.pi.model.Function; |
65 import com.nokia.carbide.cpp.internal.pi.model.GUITooltips; |
65 import com.nokia.carbide.cpp.internal.pi.model.GUITooltips; |
66 import com.nokia.carbide.cpp.internal.pi.model.GenericSampledTrace; |
66 import com.nokia.carbide.cpp.internal.pi.model.GenericSampledTrace; |
67 import com.nokia.carbide.cpp.internal.pi.model.GenericTrace; |
67 import com.nokia.carbide.cpp.internal.pi.model.GenericTrace; |
|
68 import com.nokia.carbide.cpp.internal.pi.model.IFunction; |
68 import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData; |
69 import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData; |
69 import com.nokia.carbide.cpp.internal.pi.model.TraceDataRepository; |
70 import com.nokia.carbide.cpp.internal.pi.model.TraceDataRepository; |
70 import com.nokia.carbide.cpp.internal.pi.test.PIAnalyser; |
71 import com.nokia.carbide.cpp.internal.pi.test.PIAnalyser; |
71 import com.nokia.carbide.cpp.internal.pi.utils.QuickSortImpl; |
72 import com.nokia.carbide.cpp.internal.pi.utils.QuickSortImpl; |
72 import com.nokia.carbide.cpp.internal.pi.utils.Sortable; |
73 import com.nokia.carbide.cpp.internal.pi.utils.Sortable; |
501 |
502 |
502 if (!threads.containsKey(sample.thread.process.name+"::"+sample.thread.threadName+"_"+sample.thread.threadId)) //$NON-NLS-1$ //$NON-NLS-2$ |
503 if (!threads.containsKey(sample.thread.process.name+"::"+sample.thread.threadName+"_"+sample.thread.threadId)) //$NON-NLS-1$ //$NON-NLS-2$ |
503 { |
504 { |
504 threads.put(s,sample.thread); |
505 threads.put(s,sample.thread); |
505 //listData.add(sample.thread.process.name+"::"+sample.thread.threadName); |
506 //listData.add(sample.thread.process.name+"::"+sample.thread.threadName); |
506 threadSampleAmount.put(s,new Integer(1)); |
507 threadSampleAmount.put(s,Integer.valueOf(1)); |
507 } |
508 } |
508 else |
509 else |
509 { |
510 { |
510 int value = ((Integer)threadSampleAmount.get(s)).intValue(); |
511 int value = ((Integer)threadSampleAmount.get(s)).intValue(); |
511 threadSampleAmount.remove(s); |
512 threadSampleAmount.remove(s); |
512 threadSampleAmount.put(s,new Integer(value+1)); |
513 threadSampleAmount.put(s,Integer.valueOf(value+1)); |
513 } |
514 } |
514 } |
515 } |
515 |
516 |
516 while(threadSampleAmount.size() > 0) |
517 while(threadSampleAmount.size() > 0) |
517 { |
518 { |
605 } |
606 } |
606 } |
607 } |
607 if (!containsKey) |
608 if (!containsKey) |
608 { |
609 { |
609 binaries.put(bi, sample); |
610 binaries.put(bi, sample); |
610 binarySampleAmount.put(bi, new Integer(1)); |
611 binarySampleAmount.put(bi, Integer.valueOf(1)); |
611 } |
612 } |
612 else |
613 else |
613 { |
614 { |
614 for (Enumeration<BinaryNameItem> e = binarySampleAmount.keys(); e.hasMoreElements();) |
615 for (Enumeration<BinaryNameItem> e = binarySampleAmount.keys(); e.hasMoreElements();) |
615 { |
616 { |
616 BinaryNameItem biTemp = e.nextElement(); |
617 BinaryNameItem biTemp = e.nextElement(); |
617 if (biTemp.toString().equalsIgnoreCase(bi.toString())) |
618 if (biTemp.toString().equalsIgnoreCase(bi.toString())) |
618 { |
619 { |
619 int value = ((Integer)binarySampleAmount.get(biTemp)).intValue(); |
620 int value = ((Integer)binarySampleAmount.get(biTemp)).intValue(); |
620 binarySampleAmount.remove(biTemp); |
621 binarySampleAmount.remove(biTemp); |
621 binarySampleAmount.put(biTemp, new Integer(value+1)); |
622 binarySampleAmount.put(biTemp, Integer.valueOf(value+1)); |
622 } |
623 } |
623 } |
624 } |
624 } |
625 } |
625 } |
626 } |
626 |
627 |
732 String threadName = sample.thread.process.name+"::"+sample.thread.threadName+"_"+sample.thread.threadId; //$NON-NLS-1$ //$NON-NLS-2$ |
733 String threadName = sample.thread.process.name+"::"+sample.thread.threadName+"_"+sample.thread.threadId; //$NON-NLS-1$ //$NON-NLS-2$ |
733 |
734 |
734 if (!threadVector.contains(threadName)) |
735 if (!threadVector.contains(threadName)) |
735 { |
736 { |
736 threadVector.add(threadName); |
737 threadVector.add(threadName); |
737 threadSampleAmount.add(new Integer(1)); |
738 threadSampleAmount.add(Integer.valueOf(1)); |
738 } |
739 } |
739 else |
740 else |
740 { |
741 { |
741 //int value = ((Integer)binarySampleAmount.get(binaryName)).intValue(); |
742 //int value = ((Integer)binarySampleAmount.get(binaryName)).intValue(); |
742 int index = threadVector.indexOf(threadName); |
743 int index = threadVector.indexOf(threadName); |
743 int value = ((Integer)threadSampleAmount.get(index)).intValue(); |
744 int value = ((Integer)threadSampleAmount.get(index)).intValue(); |
744 |
745 |
745 threadSampleAmount.remove(index); |
746 threadSampleAmount.remove(index); |
746 threadSampleAmount.add(index,new Integer(value+1)); |
747 threadSampleAmount.add(index,Integer.valueOf(value+1)); |
747 } |
748 } |
748 } |
749 } |
749 } |
750 } |
750 |
751 |
751 int totalSamples = 0; |
752 int totalSamples = 0; |
889 BinaryNameItem binaryName = getBinaryNameForGppSample(sample); |
890 BinaryNameItem binaryName = getBinaryNameForGppSample(sample); |
890 |
891 |
891 if (!binaryVector.contains(binaryName)) |
892 if (!binaryVector.contains(binaryName)) |
892 { |
893 { |
893 binaryVector.add(binaryName); |
894 binaryVector.add(binaryName); |
894 binarySampleAmount.add(new Integer(1)); |
895 binarySampleAmount.add(Integer.valueOf(1)); |
895 } |
896 } |
896 else |
897 else |
897 { |
898 { |
898 //int value = ((Integer)binarySampleAmount.get(binaryName)).intValue(); |
899 //int value = ((Integer)binarySampleAmount.get(binaryName)).intValue(); |
899 int index = binaryVector.indexOf(binaryName); |
900 int index = binaryVector.indexOf(binaryName); |
900 int value = ((Integer)binarySampleAmount.get(index)).intValue(); |
901 int value = ((Integer)binarySampleAmount.get(index)).intValue(); |
901 |
902 |
902 binarySampleAmount.remove(index); |
903 binarySampleAmount.remove(index); |
903 binarySampleAmount.add(index,new Integer(value+1)); |
904 binarySampleAmount.add(index,Integer.valueOf(value+1)); |
904 } |
905 } |
905 } |
906 } |
906 } |
907 } |
907 |
908 |
908 int totalSamples = 0; |
909 int totalSamples = 0; |
1091 { |
1092 { |
1092 // add the function name to percentData |
1093 // add the function name to percentData |
1093 percentData.add(getFunctionNameForGppSample(s)); |
1094 percentData.add(getFunctionNameForGppSample(s)); |
1094 // this is the first sample for this function, thus add number 1 |
1095 // this is the first sample for this function, thus add number 1 |
1095 // to the percent value list |
1096 // to the percent value list |
1096 percentValueList.add(new Integer(1)); |
1097 percentValueList.add(Integer.valueOf(1)); |
1097 // add a vector for the function offset values |
1098 // add a vector for the function offset values |
1098 |
1099 |
1099 if (this.functionPercents.isSelected() == true) |
1100 if (this.functionPercents.isSelected() == true) |
1100 { |
1101 { |
1101 Vector functionIndexVector = new Vector(); |
1102 Vector functionIndexVector = new Vector(); |
1117 ((Integer)percentValueList.elementAt(index)).intValue()); |
1118 ((Integer)percentValueList.elementAt(index)).intValue()); |
1118 */ |
1119 */ |
1119 |
1120 |
1120 Integer value = (Integer)percentValueList.elementAt(index); |
1121 Integer value = (Integer)percentValueList.elementAt(index); |
1121 percentValueList.remove(index); |
1122 percentValueList.remove(index); |
1122 percentValueList.add(index,new Integer(value.intValue()+1)); |
1123 percentValueList.add(index,Integer.valueOf(value.intValue()+1)); |
1123 |
1124 |
1124 if (this.functionPercents.isSelected() == true) |
1125 if (this.functionPercents.isSelected() == true) |
1125 { |
1126 { |
1126 Vector functionIndexVector = (Vector)functionIndexList.elementAt(index); |
1127 Vector functionIndexVector = (Vector)functionIndexList.elementAt(index); |
1127 Long offset = getFunctionOffsetForGppSample(s); |
1128 Long offset = getFunctionOffsetForGppSample(s); |
1228 private BinaryNameItem getBinaryNameForGppSample(GppSample s) |
1229 private BinaryNameItem getBinaryNameForGppSample(GppSample s) |
1229 { |
1230 { |
1230 String binaryName; |
1231 String binaryName; |
1231 if (this.symbolPrimary || this.ittTrace == null) |
1232 if (this.symbolPrimary || this.ittTrace == null) |
1232 { |
1233 { |
1233 binaryName = s.currentFunctionSym.functionBinary.binaryName; |
1234 binaryName = s.getCurrentFunctionSym().getFunctionBinary().getBinaryName(); |
1234 if (!binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1235 if (!binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1235 return new BinaryNameItem(binaryName,false); |
1236 return new BinaryNameItem(binaryName,false); |
1236 } |
1237 } |
1237 |
1238 |
1238 if (s.currentFunctionItt != null) |
1239 if (s.getCurrentFunctionItt() != null) |
1239 { |
1240 { |
1240 binaryName = s.currentFunctionItt.functionBinary.binaryName; |
1241 binaryName = s.getCurrentFunctionItt().getFunctionBinary().getBinaryName(); |
1241 if (!binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1242 if (!binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1242 { |
1243 { |
1243 return new BinaryNameItem(binaryName,true); |
1244 return new BinaryNameItem(binaryName,true); |
1244 } |
1245 } |
1245 else |
1246 else |
1246 { |
1247 { |
1247 binaryName = s.currentFunctionSym.functionBinary.binaryName; |
1248 binaryName = s.getCurrentFunctionSym().getFunctionBinary().getBinaryName(); |
1248 if (binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1249 if (binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1249 return new BinaryNameItem(Messages.getString("NewFunctionAnalyse.binaryNotFound"),true); //$NON-NLS-1$ |
1250 return new BinaryNameItem(Messages.getString("NewFunctionAnalyse.binaryNotFound"),true); //$NON-NLS-1$ |
1250 else |
1251 else |
1251 return new BinaryNameItem(binaryName,false); |
1252 return new BinaryNameItem(binaryName,false); |
1252 } |
1253 } |
1253 } |
1254 } |
1254 else if (!s.currentFunctionSym.functionBinary.binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1255 else if (!s.getCurrentFunctionSym().getFunctionBinary().getBinaryName().endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1255 { |
1256 { |
1256 binaryName = s.currentFunctionSym.functionBinary.binaryName; |
1257 binaryName = s.getCurrentFunctionSym().getFunctionBinary().getBinaryName(); |
1257 return new BinaryNameItem(binaryName,false); |
1258 return new BinaryNameItem(binaryName,false); |
1258 } |
1259 } |
1259 else |
1260 else |
1260 { |
1261 { |
1261 return new BinaryNameItem(Messages.getString("NewFunctionAnalyse.binaryNotFound"),false); //$NON-NLS-1$ |
1262 return new BinaryNameItem(Messages.getString("NewFunctionAnalyse.binaryNotFound"),false); //$NON-NLS-1$ |
1334 |
1335 |
1335 private Long getFunctionOffsetForGppSample(GppSample s) |
1336 private Long getFunctionOffsetForGppSample(GppSample s) |
1336 { |
1337 { |
1337 //String functionName; |
1338 //String functionName; |
1338 if ((this.symbolPrimary || this.ittTrace == null) && |
1339 if ((this.symbolPrimary || this.ittTrace == null) && |
1339 !s.currentFunctionSym.functionBinary.binaryName.endsWith(Messages.getString("NewFunctionAnalyse.notFound")) ) //$NON-NLS-1$ |
1340 !s.getCurrentFunctionSym().getFunctionBinary().getBinaryName().endsWith(Messages.getString("NewFunctionAnalyse.notFound")) ) //$NON-NLS-1$ |
1340 { |
1341 { |
1341 return new Long(s.programCounter-s.currentFunctionSym.startAddress.longValue()); |
1342 return new Long(s.programCounter-s.getCurrentFunctionSym().getStartAddress().longValue()); |
1342 } |
1343 } |
1343 if (s.currentFunctionItt != null && !s.currentFunctionItt.functionName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1344 if (s.getCurrentFunctionItt() != null && !s.getCurrentFunctionItt().getFunctionName().endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1344 { |
1345 { |
1345 //System.out.println("OFF:"+(s.programCounter-s.currentFunctionItt.startAddress.longValue())+" PC: "+Long.toHexString(s.programCounter)+" start"+Long.toHexString(s.currentFunctionItt.startAddress.longValue())); |
1346 //System.out.println("OFF:"+(s.programCounter-s.currentFunctionItt.startAddress.longValue())+" PC: "+Long.toHexString(s.programCounter)+" start"+Long.toHexString(s.currentFunctionItt.startAddress.longValue())); |
1346 return new Long(s.programCounter-s.currentFunctionItt.startAddress.longValue()); |
1347 return new Long(s.programCounter-s.getCurrentFunctionItt().getStartAddress().longValue()); |
1347 } |
1348 } |
1348 else if (s.currentFunctionSym != null) |
1349 else if (s.getCurrentFunctionSym() != null) |
1349 { |
1350 { |
1350 return new Long(s.programCounter-s.currentFunctionSym.startAddress.longValue()); |
1351 return new Long(s.programCounter-s.getCurrentFunctionSym().getStartAddress().longValue()); |
1351 } |
1352 } |
1352 else |
1353 else |
1353 { |
1354 { |
1354 return new Long(666666); |
1355 return new Long(666666); |
1355 } |
1356 } |
1368 { |
1369 { |
1369 return item; |
1370 return item; |
1370 } |
1371 } |
1371 else |
1372 else |
1372 { |
1373 { |
1373 functionName = s.currentFunctionSym.functionName; |
1374 functionName = s.getCurrentFunctionSym().getFunctionName(); |
1374 if (!functionName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1375 if (!functionName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1375 { |
1376 { |
1376 item = new FunctionNameItem(functionName,s.currentFunctionSym,false); |
1377 item = new FunctionNameItem(functionName,s.getCurrentFunctionSym(),false); |
1377 this.functionNameCacheSym.put(s,item); |
1378 this.functionNameCacheSym.put(s,item); |
1378 return item; |
1379 return item; |
1379 } |
1380 } |
1380 } |
1381 } |
1381 } |
1382 } |
1382 |
1383 |
1383 if (s.currentFunctionItt != null) |
1384 if (s.getCurrentFunctionItt() != null) |
1384 { |
1385 { |
1385 FunctionNameItem item = (FunctionNameItem)this.functionNameCacheItt.get(s); |
1386 FunctionNameItem item = (FunctionNameItem)this.functionNameCacheItt.get(s); |
1386 if (item != null) return item; |
1387 if (item != null) return item; |
1387 |
1388 |
1388 functionName = s.currentFunctionItt.functionName; |
1389 functionName = s.getCurrentFunctionItt().getFunctionName(); |
1389 |
1390 |
1390 if (!functionName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1391 if (!functionName.endsWith(Messages.getString("NewFunctionAnalyse.notFound"))) //$NON-NLS-1$ |
1391 { |
1392 { |
1392 item = new FunctionNameItem(functionName,s.currentFunctionItt,true); |
1393 item = new FunctionNameItem(functionName,s.getCurrentFunctionItt(),true); |
1393 this.functionNameCacheItt.put(s,item); |
1394 this.functionNameCacheItt.put(s,item); |
1394 return item; |
1395 return item; |
1395 // return new FunctionNameItem(functionName,s.currentFunctionItt,true); |
1396 // return new FunctionNameItem(functionName,s.currentFunctionItt,true); |
1396 } |
1397 } |
1397 else |
1398 else |
1398 { |
1399 { |
1399 item = (FunctionNameItem)this.functionNameCacheSym.get(s); |
1400 item = (FunctionNameItem)this.functionNameCacheSym.get(s); |
1400 if (item != null) return item; |
1401 if (item != null) return item; |
1401 |
1402 |
1402 functionName = s.currentFunctionSym.functionName; |
1403 functionName = s.getCurrentFunctionSym().getFunctionName(); |
1403 item = new FunctionNameItem(functionName,s.currentFunctionSym,false); |
1404 item = new FunctionNameItem(functionName,s.getCurrentFunctionSym(),false); |
1404 this.functionNameCacheSym.put(s,item); |
1405 this.functionNameCacheSym.put(s,item); |
1405 return item; |
1406 return item; |
1406 // return new FunctionNameItem(functionName,s.currentFunctionSym,false); |
1407 // return new FunctionNameItem(functionName,s.currentFunctionSym,false); |
1407 } |
1408 } |
1408 } |
1409 } |
1409 else if (s.currentFunctionSym != null) |
1410 else if (s.getCurrentFunctionSym() != null) |
1410 { |
1411 { |
1411 FunctionNameItem item = (FunctionNameItem)this.functionNameCacheSym.get(s); |
1412 FunctionNameItem item = (FunctionNameItem)this.functionNameCacheSym.get(s); |
1412 if (item != null) return item; |
1413 if (item != null) return item; |
1413 |
1414 |
1414 functionName = s.currentFunctionSym.functionName; |
1415 functionName = s.getCurrentFunctionSym().getFunctionName(); |
1415 item = new FunctionNameItem(functionName,s.currentFunctionSym,false); |
1416 item = new FunctionNameItem(functionName,s.getCurrentFunctionSym(),false); |
1416 this.functionNameCacheSym.put(s,item); |
1417 this.functionNameCacheSym.put(s,item); |
1417 return item; |
1418 return item; |
1418 // return new FunctionNameItem(functionName,s.currentFunctionSym,false); |
1419 // return new FunctionNameItem(functionName,s.currentFunctionSym,false); |
1419 } |
1420 } |
1420 else |
1421 else |
1775 { |
1776 { |
1776 public String name; |
1777 public String name; |
1777 public boolean itt; |
1778 public boolean itt; |
1778 public int sampleAmount; |
1779 public int sampleAmount; |
1779 public int totalSamples; |
1780 public int totalSamples; |
1780 public Function function; |
1781 public IFunction function; |
1781 public Vector offsetVector; |
1782 public Vector offsetVector; |
1782 public double currentPercent; |
1783 public double currentPercent; |
1783 |
1784 |
1784 public FunctionNameItem(String name, Function function, boolean itt) |
1785 public FunctionNameItem(String name, IFunction function, boolean itt) |
1785 { |
1786 { |
1786 this.offsetVector = new Vector(); |
1787 this.offsetVector = new Vector(); |
1787 this.sampleAmount = 0; |
1788 this.sampleAmount = 0; |
1788 this.totalSamples = 0; |
1789 this.totalSamples = 0; |
1789 this.function = function; |
1790 this.function = function; |
2080 setBorder(null); |
2081 setBorder(null); |
2081 } |
2082 } |
2082 |
2083 |
2083 if (item.function != null) |
2084 if (item.function != null) |
2084 { |
2085 { |
2085 if (item.function.functionBinary != null && item.function.functionBinary.binaryName != null) |
2086 if (item.function.getFunctionBinary() != null && item.function.getFunctionBinary().getBinaryName() != null) |
2086 { |
2087 { |
2087 this.setToolTipText(Messages.getString("NewFunctionAnalyse.function1")+item.function.functionName+Messages.getString("NewFunctionAnalyse.function2")+ //$NON-NLS-1$ //$NON-NLS-2$ |
2088 this.setToolTipText(Messages.getString("NewFunctionAnalyse.function1")+item.function.getFunctionName()+Messages.getString("NewFunctionAnalyse.function2")+ //$NON-NLS-1$ //$NON-NLS-2$ |
2088 Long.toHexString(item.function.startAddress.longValue())+ |
2089 Long.toHexString(item.function.getStartAddress().longValue())+ |
2089 Messages.getString("NewFunctionAnalyse.function3")+item.function.functionBinary.binaryName); //$NON-NLS-1$ |
2090 Messages.getString("NewFunctionAnalyse.function3")+item.function.getFunctionBinary().getBinaryName()); //$NON-NLS-1$ |
2090 } |
2091 } |
2091 else |
2092 else |
2092 { |
2093 { |
2093 this.setToolTipText(Messages.getString("NewFunctionAnalyse.function1")+item.function.functionName+Messages.getString("NewFunctionAnalyse.function2")+ //$NON-NLS-1$ //$NON-NLS-2$ |
2094 this.setToolTipText(Messages.getString("NewFunctionAnalyse.function1")+item.function.getFunctionName()+Messages.getString("NewFunctionAnalyse.function2")+ //$NON-NLS-1$ //$NON-NLS-2$ |
2094 Long.toHexString(item.function.startAddress.longValue())+ |
2095 Long.toHexString(item.function.getStartAddress().longValue())+ |
2095 Messages.getString("NewFunctionAnalyse.function3") + Messages.getString("NewFunctionAnalyse.binaryNotFound")); //$NON-NLS-1$ //$NON-NLS-2$ |
2096 Messages.getString("NewFunctionAnalyse.function3") + Messages.getString("NewFunctionAnalyse.binaryNotFound")); //$NON-NLS-1$ //$NON-NLS-2$ |
2096 } |
2097 } |
2097 } |
2098 } |
2098 else |
2099 else |
2099 { |
2100 { |