sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.address/src/com/nokia/carbide/cpp/pi/address/AddrThreadTable.java
changeset 12 ae255c9aa552
parent 5 844b047e260d
equal deleted inserted replaced
11:5b9d4d8641ce 12:ae255c9aa552
    59 import org.eclipse.swt.widgets.TableColumn;
    59 import org.eclipse.swt.widgets.TableColumn;
    60 import org.eclipse.swt.widgets.TableItem;
    60 import org.eclipse.swt.widgets.TableItem;
    61 
    61 
    62 import com.nokia.carbide.cpp.internal.pi.address.GppModelAdapter;
    62 import com.nokia.carbide.cpp.internal.pi.address.GppModelAdapter;
    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.analyser.ProfileVisualiser;
       
    65 import com.nokia.carbide.cpp.internal.pi.interfaces.ISaveSamples;
    64 import com.nokia.carbide.cpp.internal.pi.interfaces.ISaveSamples;
       
    65 import com.nokia.carbide.cpp.internal.pi.model.ICPUScale;
    66 import com.nokia.carbide.cpp.internal.pi.model.ProfiledGeneric;
    66 import com.nokia.carbide.cpp.internal.pi.model.ProfiledGeneric;
    67 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThread;
    67 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThread;
    68 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThreshold;
    68 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThreshold;
    69 import com.nokia.carbide.cpp.internal.pi.visual.Defines;
    69 import com.nokia.carbide.cpp.internal.pi.visual.Defines;
    70 import com.nokia.carbide.cpp.internal.pi.visual.PIEvent;
    70 import com.nokia.carbide.cpp.internal.pi.visual.PIEvent;
   404 					return SHOW_ITEM_VALUE;
   404 					return SHOW_ITEM_VALUE;
   405 				}
   405 				}
   406 				case COLUMN_ID_PERCENT_LOAD:
   406 				case COLUMN_ID_PERCENT_LOAD:
   407 				{
   407 				{
   408 					// Percent load string
   408 					// Percent load string
       
   409 					Object object = profiledItem.getAdapter(ICPUScale.class);
       
   410 					if(object != null && profiledItem.isScaledCpu()){
       
   411 						String avgLoad = profiledItem.getAverageLoadValueString(graphIndex);
       
   412 						if (avgLoad != null && avgLoad.length() > 0) {
       
   413 							if(avgLoad.indexOf(',') != -1){ //$NON-NLS-1$
       
   414 								avgLoad = avgLoad.replace(',', '.');
       
   415 							}
       
   416 							float value = Float.valueOf(avgLoad);
       
   417 							if (value > 0.0) {
       
   418 								ICPUScale cpuScale = (ICPUScale) object;
       
   419 								value = value / 100;
       
   420 								int startTime = (int) (PIPageEditor
       
   421 										.currentPageEditor().getStartTime() * 1000);
       
   422 								int endTime = (int) (PIPageEditor
       
   423 										.currentPageEditor().getEndTime() * 1000);
       
   424 								value = value
       
   425 										* cpuScale.calculateScale(startTime,
       
   426 												endTime) * 100;
       
   427 								DecimalFormat decimalFormat = new DecimalFormat(
       
   428 										"#0.00"); //$NON-NLS-1$
       
   429 								return decimalFormat.format(value);
       
   430 							}
       
   431 						}									
       
   432 					}
   409 					return profiledItem.getAverageLoadValueString(graphIndex);
   433 					return profiledItem.getAverageLoadValueString(graphIndex);
   410 				}
   434 				}
   411 				case COLUMN_ID_THREAD:
   435 				case COLUMN_ID_THREAD:
   412 				{
   436 				{
   413 					// Thread
   437 					// Thread
   680    				nameList[i] = pGeneric.getNameString();
   704    				nameList[i] = pGeneric.getNameString();
   681    			}
   705    			}
   682 		}
   706 		}
   683 
   707 
   684 		PIVisualSharedData shared = myGraph.getSharedDataInstance();
   708 		PIVisualSharedData shared = myGraph.getSharedDataInstance();
   685 		shared.GPP_SelectedThreadNames = nameList;
   709 		shared.gppSelectedThreadNames = nameList;
   686 
   710 
   687   		if (   (totalSamples != 0)
   711   		if (   (totalSamples != 0)
   688       		|| (myGraph.getDrawMode() == Defines.THREADS))
   712       		|| (myGraph.getDrawMode() == Defines.THREADS))
   689       			selectionChangeNotify();
   713       			selectionChangeNotify();
   690 
   714 
   720 		}
   744 		}
   721 
   745 
   722         // this table's set of checkbox-selected rows has changed,
   746         // this table's set of checkbox-selected rows has changed,
   723 		// so propagate that information
   747 		// so propagate that information
   724 		PIVisualSharedData shared = myGraph.getSharedDataInstance();
   748 		PIVisualSharedData shared = myGraph.getSharedDataInstance();
   725 		shared.GPP_SelectedThreadNames = nameList;
   749 		shared.gppSelectedThreadNames = nameList;
   726 
   750 
   727 			selectionChangeNotify();
   751 			selectionChangeNotify();
   728   		this.table.deselectAll();
   752   		this.table.deselectAll();
   729 	}
   753 	}
   730 	
   754 	
  1433 				threadNames[i] = pt.getNameString();
  1457 				threadNames[i] = pt.getNameString();
  1434 			}
  1458 			}
  1435 		}
  1459 		}
  1436 
  1460 
  1437         PIVisualSharedData shared = myGraph.getSharedDataInstance();
  1461         PIVisualSharedData shared = myGraph.getSharedDataInstance();
  1438 		shared.GPP_SelectedThreadNames = threadNames;
  1462 		shared.gppSelectedThreadNames = threadNames;
  1439 	}
  1463 	}
  1440 
  1464 
  1441 	private class SharedCheckHandler implements ICheckStateListener
  1465 	private class SharedCheckHandler implements ICheckStateListener
  1442 	{
  1466 	{
  1443 		public void checkStateChanged(CheckStateChangedEvent event) {
  1467 		public void checkStateChanged(CheckStateChangedEvent event) {