changeset 5 | 844b047e260d |
parent 2 | b9ab3b238396 |
child 12 | ae255c9aa552 |
4:615035072f7e | 5:844b047e260d |
---|---|
24 import java.text.DecimalFormat; |
24 import java.text.DecimalFormat; |
25 import java.util.ArrayList; |
25 import java.util.ArrayList; |
26 import java.util.Arrays; |
26 import java.util.Arrays; |
27 import java.util.Comparator; |
27 import java.util.Comparator; |
28 import java.util.Enumeration; |
28 import java.util.Enumeration; |
29 import java.util.Hashtable; |
|
30 import java.util.Vector; |
29 import java.util.Vector; |
31 |
30 |
32 import org.eclipse.jface.viewers.CheckStateChangedEvent; |
31 import org.eclipse.jface.viewers.CheckStateChangedEvent; |
33 import org.eclipse.jface.viewers.CheckboxTableViewer; |
32 import org.eclipse.jface.viewers.CheckboxTableViewer; |
34 import org.eclipse.jface.viewers.ICheckStateListener; |
33 import org.eclipse.jface.viewers.ICheckStateListener; |
56 import org.eclipse.swt.widgets.Sash; |
55 import org.eclipse.swt.widgets.Sash; |
57 import org.eclipse.swt.widgets.Table; |
56 import org.eclipse.swt.widgets.Table; |
58 import org.eclipse.swt.widgets.TableColumn; |
57 import org.eclipse.swt.widgets.TableColumn; |
59 import org.eclipse.swt.widgets.TableItem; |
58 import org.eclipse.swt.widgets.TableItem; |
60 |
59 |
60 import com.nokia.carbide.cpp.internal.pi.address.GppModelAdapter; |
|
61 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository; |
61 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository; |
62 import com.nokia.carbide.cpp.internal.pi.analyser.ProfileVisualiser; |
62 import com.nokia.carbide.cpp.internal.pi.analyser.ProfileVisualiser; |
63 import com.nokia.carbide.cpp.internal.pi.model.ProfiledBinary; |
|
64 import com.nokia.carbide.cpp.internal.pi.model.ProfiledFunction; |
63 import com.nokia.carbide.cpp.internal.pi.model.ProfiledFunction; |
65 import com.nokia.carbide.cpp.internal.pi.model.ProfiledGeneric; |
64 import com.nokia.carbide.cpp.internal.pi.model.ProfiledGeneric; |
66 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThread; |
|
67 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThreshold; |
65 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThreshold; |
68 import com.nokia.carbide.cpp.internal.pi.visual.Defines; |
66 import com.nokia.carbide.cpp.internal.pi.visual.Defines; |
69 import com.nokia.carbide.cpp.internal.pi.visual.PIEvent; |
67 import com.nokia.carbide.cpp.internal.pi.visual.PIEvent; |
70 import com.nokia.carbide.cpp.internal.pi.visual.PIVisualSharedData; |
68 import com.nokia.carbide.cpp.internal.pi.visual.PIVisualSharedData; |
71 import com.nokia.carbide.cpp.pi.editors.PIPageEditor; |
69 import com.nokia.carbide.cpp.pi.editors.PIPageEditor; |
77 { |
75 { |
78 // local copy of profiled binaries, which we can sort |
76 // local copy of profiled binaries, which we can sort |
79 // without affecting the original |
77 // without affecting the original |
80 Vector<ProfiledGeneric> profiledFunctions = new Vector<ProfiledGeneric>(); |
78 Vector<ProfiledGeneric> profiledFunctions = new Vector<ProfiledGeneric>(); |
81 |
79 |
82 public AddrFunctionTable(GppTraceGraph myGraph, Composite parent) |
80 public AddrFunctionTable(GppTraceGraph myGraph, Composite parent, GppModelAdapter adapter) |
83 { |
81 { |
84 this.myGraph = myGraph; |
82 super(myGraph, parent, adapter); |
85 this.parent = parent; |
|
86 } |
83 } |
87 |
84 |
88 public void createTableViewer(int drawMode) |
85 public void createTableViewer(int drawMode) |
89 { |
86 { |
90 if (this.parent == null) |
87 if (this.parent == null) |
163 |
160 |
164 // select/deselect column |
161 // select/deselect column |
165 column = new TableColumn(table, SWT.CENTER); |
162 column = new TableColumn(table, SWT.CENTER); |
166 column.setText(COLUMN_HEAD_SHOW); |
163 column.setText(COLUMN_HEAD_SHOW); |
167 column.setWidth(COLUMN_WIDTH_SHOW); |
164 column.setWidth(COLUMN_WIDTH_SHOW); |
168 column.setData(new Integer(COLUMN_ID_SHOW)); |
165 column.setData(Integer.valueOf(COLUMN_ID_SHOW)); |
169 column.setMoveable(true); |
166 column.setMoveable(true); |
170 column.setResizable(true); |
167 column.setResizable(true); |
171 column.addSelectionListener(new ColumnSelectionHandler()); |
168 column.addSelectionListener(new ColumnSelectionHandler()); |
172 |
169 |
173 // percent load column |
170 // percent load column |
174 column = new TableColumn(table, SWT.RIGHT); |
171 column = new TableColumn(table, SWT.RIGHT); |
175 column.setText(COLUMN_HEAD_PERCENT_LOAD); |
172 column.setText(COLUMN_HEAD_PERCENT_LOAD); |
176 column.setWidth(COLUMN_WIDTH_PERCENT_LOAD); |
173 column.setWidth(COLUMN_WIDTH_PERCENT_LOAD); |
177 column.setData(new Integer(COLUMN_ID_PERCENT_LOAD)); |
174 column.setData(Integer.valueOf(COLUMN_ID_PERCENT_LOAD)); |
178 column.setMoveable(true); |
175 column.setMoveable(true); |
179 column.setResizable(true); |
176 column.setResizable(true); |
180 column.addSelectionListener(new ColumnSelectionHandler()); |
177 column.addSelectionListener(new ColumnSelectionHandler()); |
181 |
178 |
182 // function name column |
179 // function name column |
183 column = new TableColumn(table, SWT.LEFT); |
180 column = new TableColumn(table, SWT.LEFT); |
184 column.setText(COLUMN_HEAD_FUNCTION); |
181 column.setText(COLUMN_HEAD_FUNCTION); |
185 column.setWidth(COLUMN_WIDTH_FUNCTION_NAME); |
182 column.setWidth(COLUMN_WIDTH_FUNCTION_NAME); |
186 column.setData(new Integer(COLUMN_ID_FUNCTION)); |
183 column.setData(Integer.valueOf(COLUMN_ID_FUNCTION)); |
187 column.setMoveable(true); |
184 column.setMoveable(true); |
188 column.setResizable(true); |
185 column.setResizable(true); |
189 column.addSelectionListener(new ColumnSelectionHandler()); |
186 column.addSelectionListener(new ColumnSelectionHandler()); |
190 |
187 |
191 // function start address column |
188 // function start address column |
192 column = new TableColumn(table, SWT.CENTER); |
189 column = new TableColumn(table, SWT.CENTER); |
193 column.setText(COLUMN_HEAD_START_ADDR); |
190 column.setText(COLUMN_HEAD_START_ADDR); |
194 column.setWidth(COLUMN_WIDTH_START_ADDRESS); |
191 column.setWidth(COLUMN_WIDTH_START_ADDRESS); |
195 column.setData(new Integer(COLUMN_ID_START_ADDR)); |
192 column.setData(Integer.valueOf(COLUMN_ID_START_ADDR)); |
196 column.setMoveable(true); |
193 column.setMoveable(true); |
197 column.setResizable(true); |
194 column.setResizable(true); |
198 column.addSelectionListener(new ColumnSelectionHandler()); |
195 column.addSelectionListener(new ColumnSelectionHandler()); |
199 |
196 |
200 // binary containing function column |
197 // binary containing function column |
201 column = new TableColumn(table, SWT.LEFT); |
198 column = new TableColumn(table, SWT.LEFT); |
202 column.setText(COLUMN_HEAD_IN_BINARY); |
199 column.setText(COLUMN_HEAD_IN_BINARY); |
203 column.setWidth(COLUMN_WIDTH_IN_BINARY); |
200 column.setWidth(COLUMN_WIDTH_IN_BINARY); |
204 column.setData(new Integer(COLUMN_ID_IN_BINARY)); |
201 column.setData(Integer.valueOf(COLUMN_ID_IN_BINARY)); |
205 column.setMoveable(true); |
202 column.setMoveable(true); |
206 column.setResizable(true); |
203 column.setResizable(true); |
207 column.addSelectionListener(new ColumnSelectionHandler()); |
204 column.addSelectionListener(new ColumnSelectionHandler()); |
208 |
205 |
209 // path to binary containing function column |
206 // path to binary containing function column |
210 column = new TableColumn(table, SWT.LEFT); |
207 column = new TableColumn(table, SWT.LEFT); |
211 column.setText(COLUMN_HEAD_IN_BINARY_PATH); |
208 column.setText(COLUMN_HEAD_IN_BINARY_PATH); |
212 column.setWidth(COLUMN_WIDTH_IN_BINARY_PATH); |
209 column.setWidth(COLUMN_WIDTH_IN_BINARY_PATH); |
213 column.setData(new Integer(COLUMN_ID_IN_BINARY_PATH)); |
210 column.setData(Integer.valueOf(COLUMN_ID_IN_BINARY_PATH)); |
214 column.setMoveable(true); |
211 column.setMoveable(true); |
215 column.setResizable(true); |
212 column.setResizable(true); |
216 column.addSelectionListener(new ColumnSelectionHandler()); |
213 column.addSelectionListener(new ColumnSelectionHandler()); |
217 |
214 |
218 // sample count column |
215 // sample count column |
219 column = new TableColumn(table, SWT.CENTER); |
216 column = new TableColumn(table, SWT.CENTER); |
220 column.setText(COLUMN_HEAD_SAMPLE_COUNT); |
217 column.setText(COLUMN_HEAD_SAMPLE_COUNT); |
221 column.setWidth(COLUMN_WIDTH_SAMPLE_COUNT); |
218 column.setWidth(COLUMN_WIDTH_SAMPLE_COUNT); |
222 column.setData(new Integer(COLUMN_ID_SAMPLE_COUNT)); |
219 column.setData(Integer.valueOf(COLUMN_ID_SAMPLE_COUNT)); |
223 column.setMoveable(true); |
220 column.setMoveable(true); |
224 column.setResizable(true); |
221 column.setResizable(true); |
225 column.addSelectionListener(new ColumnSelectionHandler()); |
222 column.addSelectionListener(new ColumnSelectionHandler()); |
226 |
223 |
227 // listen for mouse clicks: to select a row, pop up a menu, etc. |
224 // listen for mouse clicks: to select a row, pop up a menu, etc. |
336 public shownFunctionsContentProvider() { |
333 public shownFunctionsContentProvider() { |
337 super(); |
334 super(); |
338 } |
335 } |
339 |
336 |
340 public Object[] getElements(Object inputElement) { |
337 public Object[] getElements(Object inputElement) { |
341 return ((Vector) inputElement).toArray(); |
338 return ((Vector<?>) inputElement).toArray(); |
342 } |
339 } |
343 |
340 |
344 public void dispose() { |
341 public void dispose() { |
345 } |
342 } |
346 |
343 |
352 |
349 |
353 public shownFunctionsLabelProvider() { |
350 public shownFunctionsLabelProvider() { |
354 super(); |
351 super(); |
355 } |
352 } |
356 |
353 |
354 /* (non-Javadoc) |
|
355 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) |
|
356 */ |
|
357 public String getColumnText(Object element, int columnIndex) { |
357 public String getColumnText(Object element, int columnIndex) { |
358 int columnId = ((Integer) table.getColumn(columnIndex).getData()).intValue(); |
358 int columnId = ((Integer) table.getColumn(columnIndex).getData()).intValue(); |
359 |
359 |
360 if (element instanceof ProfiledThreshold) { |
360 if (element instanceof ProfiledThreshold) { |
361 ProfiledThreshold pThreshold = (ProfiledThreshold) element; |
361 ProfiledThreshold pThreshold = (ProfiledThreshold) element; |
385 return pThreshold.getAverageLoadValueString(myGraph.getGraphIndex()); |
385 return pThreshold.getAverageLoadValueString(myGraph.getGraphIndex()); |
386 } |
386 } |
387 case COLUMN_ID_FUNCTION: |
387 case COLUMN_ID_FUNCTION: |
388 { |
388 { |
389 DecimalFormat timeFormat = new DecimalFormat(Messages.getString("AddrFunctionTable.decimalFormat")); //$NON-NLS-1$ |
389 DecimalFormat timeFormat = new DecimalFormat(Messages.getString("AddrFunctionTable.decimalFormat")); //$NON-NLS-1$ |
390 int count = pThreshold.getItemCount(myGraph.getGraphIndex()); |
390 int count = pThreshold.getItemCount(); |
391 |
391 |
392 return count + (count > 1 ? Messages.getString("AddrFunctionTable.threshold1") : Messages.getString("AddrFunctionTable.threshold2")) //$NON-NLS-1$ //$NON-NLS-2$ |
392 return count + (count > 1 ? Messages.getString("AddrFunctionTable.threshold1") : Messages.getString("AddrFunctionTable.threshold2")) //$NON-NLS-1$ //$NON-NLS-2$ |
393 + timeFormat.format((Double)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdLoadThread") * 100.0) + Messages.getString("AddrFunctionTable.threshold3") //$NON-NLS-1$ //$NON-NLS-2$ |
393 + timeFormat.format((Double)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdLoadThread") * 100.0) + Messages.getString("AddrFunctionTable.threshold3") //$NON-NLS-1$ //$NON-NLS-2$ |
394 + (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountFunction") + Messages.getString("AddrFunctionTable.threshold4"); //$NON-NLS-1$ //$NON-NLS-2$ |
394 + (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountFunction") + Messages.getString("AddrFunctionTable.threshold4"); //$NON-NLS-1$ //$NON-NLS-2$ |
395 } |
395 } |
468 public Image getColumnImage(Object element, int columnIndex) { |
468 public Image getColumnImage(Object element, int columnIndex) { |
469 return null; |
469 return null; |
470 } |
470 } |
471 } |
471 } |
472 |
472 |
473 public void action(String actionString) |
473 @Override |
474 public void action(String actionString) |
|
474 { |
475 { |
475 int graphIndex = this.myGraph.getGraphIndex(); |
476 int graphIndex = this.myGraph.getGraphIndex(); |
476 |
477 |
477 if ( actionString.equals("add") //$NON-NLS-1$ |
478 if ( actionString.equals("add") //$NON-NLS-1$ |
478 || actionString.equals("remove")) //$NON-NLS-1$ |
479 || actionString.equals("remove")) //$NON-NLS-1$ |
595 boolean enabled = threshold.isEnabled(graphIndex); |
596 boolean enabled = threshold.isEnabled(graphIndex); |
596 |
597 |
597 this.tableItemData.clear(); |
598 this.tableItemData.clear(); |
598 this.profiledFunctions.clear(); |
599 this.profiledFunctions.clear(); |
599 this.myGraph.getSortedFunctions().clear(); |
600 this.myGraph.getSortedFunctions().clear(); |
600 if (threshold.getItems(graphIndex) != null) |
601 if (threshold.getItems() != null) |
601 threshold.getItems(graphIndex).clear(); |
602 threshold.getItems().clear(); |
602 threshold.initAll(); |
603 adapter.init(threshold, graphIndex); |
603 |
604 |
604 // if this appears, it needs to be the first item, so that it is drawn at the bottom |
605 // if this appears, it needs to be the first item, so that it is drawn at the bottom |
605 myGraph.getSortedFunctions().add(threshold); |
606 myGraph.getSortedFunctions().add(threshold); |
606 |
607 |
607 int functionThreshold = (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountFunction"); //$NON-NLS-1$ |
608 int functionThreshold = (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountFunction"); //$NON-NLS-1$ |
608 for (int i = 0; i < this.myGraph.getGppTrace().getSortedFunctions().size(); i++) { |
609 for (int i = 0; i < this.myGraph.getGppTrace().getSortedFunctions().size(); i++) { |
609 ProfiledGeneric nextElement = (ProfiledGeneric)this.myGraph.getGppTrace().getSortedFunctions().get(i); |
610 ProfiledGeneric nextElement = (ProfiledGeneric)this.myGraph.getGppTrace().getSortedFunctions().get(i); |
610 if (nextElement.getTotalSampleCount() < functionThreshold) { |
611 if (adapter.getTotalSampleCount(nextElement) < functionThreshold) { |
611 nextElement.setEnabled(graphIndex, enabled); |
612 nextElement.setEnabled(graphIndex, enabled); |
612 threshold.addItem(graphIndex, nextElement, 0); |
613 adapter.addItem(threshold, graphIndex, nextElement, 0); |
613 } else { |
614 } else { |
614 tableItemData.add(nextElement); |
615 tableItemData.add(nextElement); |
615 profiledFunctions.add(nextElement); |
616 profiledFunctions.add(nextElement); |
616 myGraph.getSortedFunctions().add(nextElement); |
617 myGraph.getSortedFunctions().add(nextElement); |
617 } |
618 } |
618 } |
619 } |
619 |
620 |
620 if (threshold.getItemCount(graphIndex) != 0) { |
621 if (threshold.getItemCount() != 0) { |
621 tableItemData.add(threshold); |
622 tableItemData.add(threshold); |
622 profiledFunctions.add(threshold); |
623 profiledFunctions.add(threshold); |
623 } else { |
624 } else { |
624 // remove the threshold item |
625 // remove the threshold item |
625 myGraph.getSortedFunctions().remove(0); |
626 myGraph.getSortedFunctions().remove(0); |
693 totalSamples += pGeneric.getSampleCount(graphIndex); |
694 totalSamples += pGeneric.getSampleCount(graphIndex); |
694 |
695 |
695 if (item instanceof ProfiledThreshold) |
696 if (item instanceof ProfiledThreshold) |
696 { |
697 { |
697 ProfiledThreshold pThreshold = (ProfiledThreshold)item; |
698 ProfiledThreshold pThreshold = (ProfiledThreshold)item; |
698 ArrayList<ProfiledGeneric> items = pThreshold.getItems(graphIndex); |
699 for (ProfiledGeneric p : pThreshold.getItems()) |
699 for (int j = 0; j < items.size(); j++) |
700 p.setEnabled(graphIndex, addIt); |
700 items.get(j).setEnabled(graphIndex, addIt); |
|
701 } |
701 } |
702 } |
702 } |
703 } |
703 } |
704 |
704 |
705 // this table's set of checkbox-selected rows has changed, |
705 // this table's set of checkbox-selected rows has changed, |
746 nameList[i] = pGeneric.getNameString(); |
746 nameList[i] = pGeneric.getNameString(); |
747 |
747 |
748 if (item instanceof ProfiledThreshold) |
748 if (item instanceof ProfiledThreshold) |
749 { |
749 { |
750 ProfiledThreshold pThreshold = (ProfiledThreshold)item; |
750 ProfiledThreshold pThreshold = (ProfiledThreshold)item; |
751 ArrayList<ProfiledGeneric> items = pThreshold.getItems(graphIndex); |
751 for (ProfiledGeneric p : pThreshold.getItems()) |
752 for (int j = 0; j < items.size(); j++) |
752 p.setEnabled(graphIndex, addIt); |
753 items.get(j).setEnabled(graphIndex, addIt); |
|
754 } |
753 } |
755 } |
754 } |
756 } |
755 } |
757 |
756 |
758 // this table's set of checkbox-selected rows has changed, |
757 // this table's set of checkbox-selected rows has changed, |
793 if (!(pGeneric instanceof ProfiledThreshold)){ |
792 if (!(pGeneric instanceof ProfiledThreshold)){ |
794 PIPageEditor.currentPageEditor().setDirty(); |
793 PIPageEditor.currentPageEditor().setDirty(); |
795 pGeneric.setColor(color); |
794 pGeneric.setColor(color); |
796 } |
795 } |
797 else { |
796 else { |
798 // for the threshold item, we must change every graph's function threshold item |
797 // for the threshold item, we must change every graph's thread threshold item |
799 gppTrace.getGppGraph(PIPageEditor.THREADS_PAGE, uid).getThresholdFunction().setColor(color); |
798 // CH: refactor! This could be done via an observer pattern. This class should not have knowledge of all other graphs |
800 gppTrace.getGppGraph(PIPageEditor.BINARIES_PAGE, uid).getThresholdFunction().setColor(color); |
799 gppTrace.getGppGraph(PIPageEditor.THREADS_PAGE, uid).getThresholdThread().setColor(color); |
801 gppTrace.getGppGraph(PIPageEditor.FUNCTIONS_PAGE, uid).getThresholdFunction().setColor(color); |
800 gppTrace.getGppGraph(PIPageEditor.BINARIES_PAGE, uid).getThresholdThread().setColor(color); |
801 gppTrace.getGppGraph(PIPageEditor.FUNCTIONS_PAGE, uid).getThresholdThread().setColor(color); |
|
802 // if (gppTrace.getCPUCount() > 1){ //SMP CH: comment this out once we have SMP graphs on the functions page |
|
803 // for (int cpu = 0; cpu < gppTrace.getCPUCount(); cpu++) { |
|
804 // gppTrace.getGppGraph(11 + cpu, uid).getThresholdThread().setColor(color); |
|
805 // } |
|
806 // } |
|
802 } |
807 } |
803 } |
808 } |
804 |
809 |
805 // recoloring should only be done in a draw mode that displays this table's colors |
810 // recoloring should only be done in a draw mode that displays this table's colors |
806 selectedItems[i].setBackground(COLOR_COLUMN_INDEX, palette.getColor(nameKey)); |
811 selectedItems[i].setBackground(COLOR_COLUMN_INDEX, palette.getColor(nameKey)); |
814 this.myGraph.repaint(); |
819 this.myGraph.repaint(); |
815 this.myGraph.setGraphImageChanged(true); // any selection change to drill down will change graph |
820 this.myGraph.setGraphImageChanged(true); // any selection change to drill down will change graph |
816 |
821 |
817 // if any other tabs are displaying this type of graph, they need to be scheduled for redrawing |
822 // if any other tabs are displaying this type of graph, they need to be scheduled for redrawing |
818 for (int i = 0; i < 3; i++) { |
823 for (int i = 0; i < 3; i++) { |
819 GppTraceGraph graph = gppTrace.getGppGraph(i, uid); |
824 IGppTraceGraph graph = gppTrace.getGppGraph(i, uid); |
820 |
825 |
821 if (graph == this.myGraph) |
826 if (graph == this.myGraph) |
822 continue; |
827 continue; |
823 |
828 |
824 int drawMode = graph.getDrawMode(); |
829 int drawMode = graph.getDrawMode(); |
850 return; |
855 return; |
851 } |
856 } |
852 |
857 |
853 setIsDrilldown(false); |
858 setIsDrilldown(false); |
854 |
859 |
855 // set the page's graph title |
|
856 ProfileVisualiser pV = NpiInstanceRepository.getInstance().getProfilePage(this.myGraph.getUid(), this.myGraph.getGraphIndex()); |
|
857 pV.getTitle().setText(Messages.getString("AddrFunctionTable.functionLoad")); //$NON-NLS-1$ |
|
858 pV.getTitle2().setText(""); //$NON-NLS-1$ |
|
859 |
|
860 // get rid of any existing tables and sashes |
860 // get rid of any existing tables and sashes |
861 if (this.myGraph.getLeftSash() != null) { |
861 if (this.myGraph.getLeftSash() != null) { |
862 this.myGraph.getLeftSash().dispose(); |
862 this.myGraph.getLeftSash().dispose(); |
863 this.myGraph.setLeftSash(null); |
863 this.myGraph.setLeftSash(null); |
864 |
864 |
907 } |
907 } |
908 |
908 |
909 setIsDrilldown(true); |
909 setIsDrilldown(true); |
910 |
910 |
911 if (drawMode == Defines.FUNCTIONS) { |
911 if (drawMode == Defines.FUNCTIONS) { |
912 // set the page's graph title |
|
913 ProfileVisualiser pV = NpiInstanceRepository.getInstance().getProfilePage(this.myGraph.getUid(), this.myGraph.getGraphIndex()); |
|
914 pV.getTitle().setText(Messages.getString("AddrFunctionTable.binaryLoad")); //$NON-NLS-1$ |
|
915 pV.getTitle2().setText(Messages.getString("AddrFunctionTable.functionTo")); //$NON-NLS-1$ |
|
916 |
912 |
917 // set the draw mode |
913 // set the draw mode |
918 this.myGraph.setDrawMode(Defines.FUNCTIONS_BINARIES); |
914 this.myGraph.setDrawMode(Defines.FUNCTIONS_BINARIES); |
919 |
915 |
920 // create the binary graph table viewer |
916 // create the binary graph table viewer |
922 binaryTable.createTableViewer(Defines.FUNCTIONS_BINARIES); |
918 binaryTable.createTableViewer(Defines.FUNCTIONS_BINARIES); |
923 binaryTable.setIsDrilldown(true); |
919 binaryTable.setIsDrilldown(true); |
924 |
920 |
925 // create a reduced set of binary entries based on enabled function entries |
921 // create a reduced set of binary entries based on enabled function entries |
926 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
922 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
927 Vector<ProfiledGeneric> binaries = gppTrace.setFunctionBinary(graphIndex); |
923 gppTrace.setFunctionBinary(graphIndex, adapter, this.myGraph.getProfiledBinaries()); |
928 this.myGraph.setProfiledBinaries(binaries); |
|
929 |
924 |
930 // put check marks on all rows, and sort by sample count |
925 // put check marks on all rows, and sort by sample count |
931 binaryTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledBinaries()); |
926 binaryTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledBinaries()); |
932 binaryTable.updateProfiledAndItemData(true); |
927 binaryTable.updateProfiledAndItemData(true); |
933 binaryTable.getTableViewer().setAllChecked(true); |
928 binaryTable.getTableViewer().setAllChecked(true); |
934 binaryTable.getTableViewer().refresh(); |
929 binaryTable.getTableViewer().refresh(); |
930 |
|
931 // put check marks on all enabled binary rows |
|
932 for (int i = 0; i < this.table.getItemCount(); i++) { |
|
933 ProfiledGeneric pFunction = (ProfiledGeneric) this.table.getItem(i).getData(); |
|
934 if (pFunction.isEnabled(graphIndex)) |
|
935 this.table.getItem(i).setChecked(true); |
|
936 } |
|
935 |
937 |
936 // remove colors where appropriate |
938 // remove colors where appropriate |
937 removeColor(Defines.FUNCTIONS_BINARIES); |
939 removeColor(Defines.FUNCTIONS_BINARIES); |
938 |
940 |
939 // connect the tables with a sash |
941 // connect the tables with a sash |
975 this.parent.layout(); |
977 this.parent.layout(); |
976 |
978 |
977 this.myGraph.repaint(); |
979 this.myGraph.repaint(); |
978 |
980 |
979 } else if (drawMode == Defines.FUNCTIONS_BINARIES_THREADS) { |
981 } else if (drawMode == Defines.FUNCTIONS_BINARIES_THREADS) { |
980 // set the page's graph title |
|
981 ProfileVisualiser pV = NpiInstanceRepository.getInstance().getProfilePage(this.myGraph.getUid(), this.myGraph.getGraphIndex()); |
|
982 pV.getTitle().setText(Messages.getString("AddrFunctionTable.binaryLoad")); //$NON-NLS-1$ |
|
983 pV.getTitle2().setText(Messages.getString("AddrFunctionTable.functionTo")); //$NON-NLS-1$ |
|
984 |
982 |
985 // get rid of the thread table and its sash |
983 // get rid of the thread table and its sash |
986 if (this.myGraph.getRightSash() != null) { |
984 if (this.myGraph.getRightSash() != null) { |
987 this.myGraph.getRightSash().dispose(); |
985 this.myGraph.getRightSash().dispose(); |
988 this.myGraph.setRightSash(null); |
986 this.myGraph.setRightSash(null); |
1033 return; |
1031 return; |
1034 } |
1032 } |
1035 |
1033 |
1036 setIsDrilldown(true); |
1034 setIsDrilldown(true); |
1037 |
1035 |
1038 // set the page's graph title |
|
1039 ProfileVisualiser pV = NpiInstanceRepository.getInstance().getProfilePage(this.myGraph.getUid(), this.myGraph.getGraphIndex()); |
|
1040 pV.getTitle().setText(Messages.getString("AddrFunctionTable.threadLoad")); //$NON-NLS-1$ |
|
1041 pV.getTitle2().setText(Messages.getString("AddrFunctionTable.functionToBinaryTo")); //$NON-NLS-1$ |
|
1042 |
|
1043 // set the draw mode |
1036 // set the draw mode |
1044 this.myGraph.setDrawMode(Defines.FUNCTIONS_BINARIES_THREADS); |
1037 this.myGraph.setDrawMode(Defines.FUNCTIONS_BINARIES_THREADS); |
1045 |
1038 |
1046 // create the thread graph table viewer |
1039 // create the thread graph table viewer |
1047 AddrThreadTable threadTable = this.myGraph.getThreadTable(); |
1040 AddrThreadTable threadTable = this.myGraph.getThreadTable(); |
1048 threadTable.createTableViewer(Defines.FUNCTIONS_BINARIES_THREADS); |
1041 threadTable.createTableViewer(Defines.FUNCTIONS_BINARIES_THREADS); |
1049 threadTable.setIsDrilldown(true); |
1042 threadTable.setIsDrilldown(true); |
1050 |
1043 |
1051 // create a reduced set of thread entries based on enabled binary and function entries |
1044 // create a reduced set of thread entries based on enabled binary and function entries |
1052 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
1045 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
1053 Vector<ProfiledGeneric> threads = gppTrace.setFunctionBinaryThread(graphIndex); |
1046 gppTrace.setFunctionBinaryThread(graphIndex, adapter, this.myGraph.getProfiledThreads()); |
1054 this.myGraph.setProfiledThreads(threads); |
|
1055 |
1047 |
1056 // put check marks on all rows, and sort by sample count |
1048 // put check marks on all rows, and sort by sample count |
1057 threadTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledThreads()); |
1049 threadTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledThreads()); |
1058 threadTable.updateProfiledAndItemData(true); |
1050 threadTable.updateProfiledAndItemData(true); |
1059 threadTable.getTableViewer().setAllChecked(true); |
1051 threadTable.getTableViewer().setAllChecked(true); |
1122 } |
1114 } |
1123 |
1115 |
1124 setIsDrilldown(true); |
1116 setIsDrilldown(true); |
1125 |
1117 |
1126 if (drawMode == Defines.FUNCTIONS) { |
1118 if (drawMode == Defines.FUNCTIONS) { |
1127 // set the page's graph title |
|
1128 ProfileVisualiser pV = NpiInstanceRepository.getInstance().getProfilePage(this.myGraph.getUid(), this.myGraph.getGraphIndex()); |
|
1129 pV.getTitle().setText(Messages.getString("AddrFunctionTable.threadLoad")); //$NON-NLS-1$ |
|
1130 pV.getTitle2().setText(Messages.getString("AddrFunctionTable.functionTo")); //$NON-NLS-1$ |
|
1131 |
1119 |
1132 // set the draw mode |
1120 // set the draw mode |
1133 this.myGraph.setDrawMode(Defines.FUNCTIONS_THREADS); |
1121 this.myGraph.setDrawMode(Defines.FUNCTIONS_THREADS); |
1134 |
1122 |
1135 // create the thread graph table viewer |
1123 // create the thread graph table viewer |
1137 threadTable.createTableViewer(Defines.FUNCTIONS_THREADS); |
1125 threadTable.createTableViewer(Defines.FUNCTIONS_THREADS); |
1138 threadTable.setIsDrilldown(true); |
1126 threadTable.setIsDrilldown(true); |
1139 |
1127 |
1140 // create a reduced set of thread entries based on enabled function entries |
1128 // create a reduced set of thread entries based on enabled function entries |
1141 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
1129 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
1142 Vector<ProfiledGeneric> threads = gppTrace.setFunctionThread(graphIndex); |
1130 gppTrace.setFunctionThread(graphIndex, adapter, this.myGraph.getProfiledThreads()); |
1143 this.myGraph.setProfiledThreads(threads); |
|
1144 |
1131 |
1145 // put check marks on all rows, and sort by sample count |
1132 // put check marks on all rows, and sort by sample count |
1146 threadTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledThreads()); |
1133 threadTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledThreads()); |
1147 threadTable.updateProfiledAndItemData(true); |
1134 threadTable.updateProfiledAndItemData(true); |
1148 threadTable.getTableViewer().setAllChecked(true); |
1135 threadTable.getTableViewer().setAllChecked(true); |
1190 this.parent.layout(); |
1177 this.parent.layout(); |
1191 |
1178 |
1192 this.myGraph.repaint(); |
1179 this.myGraph.repaint(); |
1193 |
1180 |
1194 } else if (drawMode == Defines.FUNCTIONS_THREADS_BINARIES) { |
1181 } else if (drawMode == Defines.FUNCTIONS_THREADS_BINARIES) { |
1195 // set the page's graph title |
|
1196 ProfileVisualiser pV = NpiInstanceRepository.getInstance().getProfilePage(this.myGraph.getUid(), this.myGraph.getGraphIndex()); |
|
1197 pV.getTitle().setText(Messages.getString("AddrFunctionTable.threadLoad")); //$NON-NLS-1$ |
|
1198 pV.getTitle2().setText(Messages.getString("AddrFunctionTable.functionTo")); //$NON-NLS-1$ |
|
1199 |
1182 |
1200 // get rid of the binary table and its sash |
1183 // get rid of the binary table and its sash |
1201 if (this.myGraph.getRightSash() != null) { |
1184 if (this.myGraph.getRightSash() != null) { |
1202 this.myGraph.getRightSash().dispose(); |
1185 this.myGraph.getRightSash().dispose(); |
1203 this.myGraph.setRightSash(null); |
1186 this.myGraph.setRightSash(null); |
1248 return; |
1231 return; |
1249 } |
1232 } |
1250 |
1233 |
1251 setIsDrilldown(true); |
1234 setIsDrilldown(true); |
1252 |
1235 |
1253 // set the page's graph title |
|
1254 ProfileVisualiser pV = NpiInstanceRepository.getInstance().getProfilePage(this.myGraph.getUid(), this.myGraph.getGraphIndex()); |
|
1255 pV.getTitle().setText(Messages.getString("AddrFunctionTable.binaryLoad")); //$NON-NLS-1$ |
|
1256 pV.getTitle2().setText(Messages.getString("AddrFunctionTable.functionToThreadTo")); //$NON-NLS-1$ |
|
1257 |
|
1258 // set the draw mode |
1236 // set the draw mode |
1259 this.myGraph.setDrawMode(Defines.FUNCTIONS_THREADS_BINARIES); |
1237 this.myGraph.setDrawMode(Defines.FUNCTIONS_THREADS_BINARIES); |
1260 |
1238 |
1261 // create the binary graph table viewer |
1239 // create the binary graph table viewer |
1262 AddrBinaryTable binaryTable = this.myGraph.getBinaryTable(); |
1240 AddrBinaryTable binaryTable = this.myGraph.getBinaryTable(); |
1263 binaryTable.createTableViewer(Defines.FUNCTIONS_THREADS_BINARIES); |
1241 binaryTable.createTableViewer(Defines.FUNCTIONS_THREADS_BINARIES); |
1264 binaryTable.setIsDrilldown(true); |
1242 binaryTable.setIsDrilldown(true); |
1265 |
1243 |
1266 // create a reduced set of binary entries based on enabled thread entries |
1244 // create a reduced set of binary entries based on enabled thread entries |
1267 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
1245 GppTrace gppTrace = (GppTrace) this.myGraph.getTrace(); |
1268 Vector<ProfiledGeneric> binaries = gppTrace.setFunctionThreadBinary(graphIndex); |
1246 gppTrace.setFunctionThreadBinary(graphIndex, adapter, this.myGraph.getProfiledBinaries()); |
1269 this.myGraph.setProfiledBinaries(binaries); |
|
1270 |
1247 |
1271 // put check marks on all rows, and sort by sample count |
1248 // put check marks on all rows, and sort by sample count |
1272 binaryTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledBinaries()); |
1249 binaryTable.quickSort(COLUMN_ID_SAMPLE_COUNT, this.myGraph.getProfiledBinaries()); |
1273 binaryTable.updateProfiledAndItemData(true); |
1250 binaryTable.updateProfiledAndItemData(true); |
1274 binaryTable.getTableViewer().setAllChecked(true); |
1251 binaryTable.getTableViewer().setAllChecked(true); |
1376 int thresholdCount = (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountFunction"); //$NON-NLS-1$ |
1353 int thresholdCount = (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountFunction"); //$NON-NLS-1$ |
1377 if (thresholdCount > 0) { |
1354 if (thresholdCount > 0) { |
1378 Vector<ProfiledGeneric> pGeneric = this.myGraph.getProfiledFunctions(); |
1355 Vector<ProfiledGeneric> pGeneric = this.myGraph.getProfiledFunctions(); |
1379 int sampleCount = 0; |
1356 int sampleCount = 0; |
1380 for (int i = 0; i < pGeneric.size(); i++) |
1357 for (int i = 0; i < pGeneric.size(); i++) |
1381 if (pGeneric.elementAt(i).getTotalSampleCount() < thresholdCount) |
1358 if (adapter.getTotalSampleCount(pGeneric.elementAt(i)) < thresholdCount) |
1382 sampleCount += pGeneric.elementAt(i).getSampleCount(graphIndex); |
1359 sampleCount += pGeneric.elementAt(i).getSampleCount(graphIndex); |
1383 this.myGraph.getThresholdFunction().setSampleCount(graphIndex, sampleCount); |
1360 this.myGraph.getThresholdFunction().setSampleCount(graphIndex, sampleCount); |
1384 } |
1361 } |
1385 } |
1362 } |
1386 |
1363 |
1402 int drawMode = this.myGraph.getDrawMode(); |
1379 int drawMode = this.myGraph.getDrawMode(); |
1403 if (drawMode == Defines.FUNCTIONS) |
1380 if (drawMode == Defines.FUNCTIONS) |
1404 return; |
1381 return; |
1405 |
1382 |
1406 GppTrace trace = (GppTrace)(this.myGraph.getTrace()); |
1383 GppTrace trace = (GppTrace)(this.myGraph.getTrace()); |
1407 Vector<ProfiledGeneric> traceFunctions = trace.getIndexedFunctions(); |
|
1408 |
|
1409 int startSampleIndex = trace.getStartSampleIndex(); |
|
1410 int endSampleIndex = trace.getEndSampleIndex(); |
|
1411 double percentPerSample; |
|
1412 if (startSampleIndex == endSampleIndex) |
|
1413 percentPerSample = 0.0; |
|
1414 else |
|
1415 percentPerSample = 100.0 / ((double)(endSampleIndex - startSampleIndex)); |
|
1416 |
|
1417 PIEvent be3 = new PIEvent(be.getValueObject(), PIEvent.SELECTION_AREA_CHANGED3); |
1384 PIEvent be3 = new PIEvent(be.getValueObject(), PIEvent.SELECTION_AREA_CHANGED3); |
1418 |
1385 |
1419 switch (drawMode) { |
1386 switch (drawMode) { |
1420 case Defines.FUNCTIONS_THREADS: |
1387 case Defines.FUNCTIONS_THREADS: |
1421 { |
1388 { |
1422 // get new thread counts and loads |
1389 trace.setFunctionThread(graphIndex, adapter, this.myGraph.getProfiledThreads()); |
1423 Vector<ProfiledGeneric> traceThreads = trace.getIndexedThreads(); |
|
1424 Vector<ProfiledGeneric> graphThreads = this.myGraph.getProfiledThreads(); |
|
1425 Hashtable<String,String> foundThreads = new Hashtable<String,String>(); |
|
1426 |
|
1427 // previous threads are not necessarily graphed this time |
|
1428 Enumeration<ProfiledGeneric> enu = graphThreads.elements(); |
|
1429 while (enu.hasMoreElements()) { |
|
1430 ProfiledThread pThread = (ProfiledThread) enu.nextElement(); |
|
1431 pThread.setEnabled(graphIndex, false); |
|
1432 } |
|
1433 graphThreads.clear(); |
|
1434 |
|
1435 ProfiledThreshold thresholdThread = this.myGraph.getThresholdThread(); |
|
1436 if (thresholdThread.isEnabled(graphIndex)) { |
|
1437 ArrayList<ProfiledGeneric> items = thresholdThread.getItems(graphIndex); |
|
1438 // disable all items below the threshold |
|
1439 for (int i = 0; i < items.size(); i++) { |
|
1440 items.get(i).setEnabled(graphIndex, false); |
|
1441 } |
|
1442 } |
|
1443 |
|
1444 GppSample[] sortedSamples = trace.getSortedGppSamples(); |
|
1445 |
|
1446 // set up in case we find threads below the threshold |
|
1447 boolean lowThread; |
|
1448 thresholdThread.init(graphIndex); |
|
1449 |
|
1450 int threadThreshold = (Integer) NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountThread"); //$NON-NLS-1$ |
|
1451 for (int i = startSampleIndex; i < endSampleIndex; i++) { |
|
1452 GppSample sample = sortedSamples[i]; |
|
1453 |
|
1454 ProfiledFunction pFunction = (ProfiledFunction) traceFunctions.elementAt(sample.functionIndex); |
|
1455 if (pFunction.isEnabled(graphIndex)) { |
|
1456 // thread list is based on functions |
|
1457 ProfiledThread pThread = (ProfiledThread) traceThreads.elementAt(sample.threadIndex); |
|
1458 String threadName = pThread.getNameString(); |
|
1459 |
|
1460 lowThread = pThread.getTotalSampleCount() < threadThreshold; |
|
1461 |
|
1462 if (!foundThreads.containsKey(threadName)) { |
|
1463 foundThreads.put(threadName, threadName); |
|
1464 if (lowThread) { |
|
1465 thresholdThread.addItem(graphIndex, pThread, 1); |
|
1466 } else { |
|
1467 pThread.setEnabled(graphIndex, true); |
|
1468 pThread.setSampleCount(graphIndex, 1); |
|
1469 graphThreads.add(pThread); |
|
1470 } |
|
1471 } else { |
|
1472 if (lowThread) |
|
1473 thresholdThread.incSampleCount(graphIndex); |
|
1474 else |
|
1475 pThread.incSampleCount(graphIndex); |
|
1476 } |
|
1477 } |
|
1478 } |
|
1479 |
|
1480 // set the % load |
|
1481 for (int i = 0; i < graphThreads.size(); i++) { |
|
1482 ProfiledThread pThread = (ProfiledThread) graphThreads.elementAt(i); |
|
1483 pThread.setLoadAndString(graphIndex, (float)(pThread.getSampleCount(graphIndex)*percentPerSample)); |
|
1484 } |
|
1485 thresholdThread.setLoadAndString(graphIndex, |
|
1486 (float)(thresholdThread.getSampleCount(graphIndex)*percentPerSample)); |
|
1487 |
1390 |
1488 // update the table items and redraw the table |
1391 // update the table items and redraw the table |
1489 this.myGraph.getThreadTable().piEventReceived(be3); |
1392 this.myGraph.getThreadTable().piEventReceived(be3); |
1490 break; |
1393 break; |
1491 } |
1394 } |
1492 case Defines.FUNCTIONS_THREADS_BINARIES: |
1395 case Defines.FUNCTIONS_THREADS_BINARIES: |
1493 { |
1396 { |
1494 // get new thread and binary counts and loads |
1397 // previous threads are not necessarily graphed this time - reset |
1495 Vector<ProfiledGeneric> traceThreads = trace.getIndexedThreads(); |
1398 trace.setFunctionThread(graphIndex, adapter, this.myGraph.getProfiledThreads()); |
1496 Vector<ProfiledGeneric> traceBinaries = trace.getIndexedBinaries(); |
1399 // previous binaries are not necessarily graphed this time - reset |
1497 Vector<ProfiledGeneric> graphThreads = this.myGraph.getProfiledThreads(); |
1400 trace.setFunctionThreadBinary(graphIndex, adapter, this.myGraph.getProfiledBinaries()); |
1498 Vector<ProfiledGeneric> graphBinaries = this.myGraph.getProfiledBinaries(); |
|
1499 Hashtable<String,String> foundThreads = new Hashtable<String,String>(); |
|
1500 Hashtable<String,String> foundBinaries = new Hashtable<String,String>(); |
|
1501 |
|
1502 // previous binaries are not necessarily graphed this time |
|
1503 Enumeration<ProfiledGeneric> enuBinary = graphBinaries.elements(); |
|
1504 while (enuBinary.hasMoreElements()) { |
|
1505 ProfiledBinary pBinary = (ProfiledBinary) enuBinary.nextElement(); |
|
1506 pBinary.setEnabled(graphIndex, false); |
|
1507 } |
|
1508 graphBinaries.clear(); |
|
1509 |
|
1510 ProfiledThreshold thresholdBinary = this.myGraph.getThresholdBinary(); |
|
1511 |
|
1512 if (thresholdBinary.isEnabled(graphIndex)) { |
|
1513 ArrayList<ProfiledGeneric> items = thresholdBinary.getItems(graphIndex); |
|
1514 // disable all items below the threshold |
|
1515 for (int i = 0; i < items.size(); i++) { |
|
1516 items.get(i).setEnabled(graphIndex, false); |
|
1517 } |
|
1518 } |
|
1519 |
|
1520 // previous threads are not necessarily graphed this time |
|
1521 Enumeration<ProfiledGeneric> enuThread = graphThreads.elements(); |
|
1522 while (enuThread.hasMoreElements()) { |
|
1523 ProfiledThread pThread = (ProfiledThread) enuThread.nextElement(); |
|
1524 pThread.setEnabled(graphIndex, false); |
|
1525 } |
|
1526 graphThreads.clear(); |
|
1527 |
|
1528 ProfiledThreshold thresholdThread = this.myGraph.getThresholdThread(); |
|
1529 |
|
1530 if (thresholdThread.isEnabled(graphIndex)) { |
|
1531 ArrayList<ProfiledGeneric> items = thresholdThread.getItems(graphIndex); |
|
1532 // disable all items below the threshold |
|
1533 for (int i = 0; i < items.size(); i++) { |
|
1534 items.get(i).setEnabled(graphIndex, false); |
|
1535 } |
|
1536 } |
|
1537 |
|
1538 GppSample[] sortedSamples = trace.getSortedGppSamples(); |
|
1539 |
|
1540 // set up in case we find binaries below the threshold |
|
1541 boolean lowBinary; |
|
1542 thresholdBinary.init(graphIndex); |
|
1543 |
|
1544 // set up in case we find threads below the threshold |
|
1545 boolean lowThread; |
|
1546 thresholdThread.init(graphIndex); |
|
1547 |
|
1548 int threadThreshold = (Integer) NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountThread"); //$NON-NLS-1$ |
|
1549 for (int i = startSampleIndex; i < endSampleIndex; i++) { |
|
1550 GppSample sample = sortedSamples[i]; |
|
1551 |
|
1552 ProfiledFunction pFunction = (ProfiledFunction) traceFunctions.elementAt(sample.functionIndex); |
|
1553 if (pFunction.isEnabled(graphIndex)) { |
|
1554 // thread list is based on functions |
|
1555 ProfiledThread pThread = (ProfiledThread) traceThreads.elementAt(sample.threadIndex); |
|
1556 String threadName = pThread.getNameString(); |
|
1557 |
|
1558 lowThread = pThread.getTotalSampleCount() < threadThreshold; |
|
1559 |
|
1560 if (!foundThreads.containsKey(threadName)) { |
|
1561 foundThreads.put(threadName, threadName); |
|
1562 if (lowThread) { |
|
1563 thresholdThread.addItem(graphIndex, pThread, 1); |
|
1564 } else { |
|
1565 pThread.setEnabled(graphIndex, true); |
|
1566 pThread.setSampleCount(graphIndex, 1); |
|
1567 graphThreads.add(pThread); |
|
1568 } |
|
1569 } else { |
|
1570 if (lowThread) |
|
1571 thresholdThread.incSampleCount(graphIndex); |
|
1572 else |
|
1573 pThread.incSampleCount(graphIndex); |
|
1574 } |
|
1575 |
|
1576 // binary list is based on functions and threads |
|
1577 ProfiledBinary pBinary = (ProfiledBinary) traceBinaries.elementAt(sample.binaryIndex); |
|
1578 String binaryName = pBinary.getNameString(); |
|
1579 |
|
1580 lowBinary = pBinary.getTotalSampleCount() < (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountBinary"); //$NON-NLS-1$ |
|
1581 |
|
1582 if (!foundBinaries.containsKey(binaryName)) { |
|
1583 foundBinaries.put(binaryName, binaryName); |
|
1584 if (lowBinary) { |
|
1585 thresholdBinary.addItem(graphIndex, pBinary, 1); |
|
1586 } else { |
|
1587 pBinary.setEnabled(graphIndex, true); |
|
1588 pBinary.setSampleCount(graphIndex, 1); |
|
1589 graphBinaries.add(pBinary); |
|
1590 } |
|
1591 } else { |
|
1592 if (lowBinary) |
|
1593 thresholdBinary.incSampleCount(graphIndex); |
|
1594 else |
|
1595 pBinary.incSampleCount(graphIndex); |
|
1596 } |
|
1597 } |
|
1598 } |
|
1599 |
|
1600 // set the % load |
|
1601 for (int i = 0; i < graphThreads.size(); i++) { |
|
1602 ProfiledThread pThread = (ProfiledThread) graphThreads.elementAt(i); |
|
1603 pThread.setLoadAndString(graphIndex, (float)(pThread.getSampleCount(graphIndex)*percentPerSample)); |
|
1604 } |
|
1605 thresholdThread.setLoadAndString(graphIndex, |
|
1606 (float)(thresholdThread.getSampleCount(graphIndex)*percentPerSample)); |
|
1607 |
|
1608 for (int i = 0; i < graphBinaries.size(); i++) { |
|
1609 ProfiledBinary pBinary = (ProfiledBinary) graphBinaries.elementAt(i); |
|
1610 pBinary.setLoadAndString(graphIndex, (float)(pBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1611 } |
|
1612 thresholdBinary.setLoadAndString(graphIndex, |
|
1613 (float)(thresholdBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1614 |
1401 |
1615 // update the table items and redraw the table |
1402 // update the table items and redraw the table |
1616 this.myGraph.getThreadTable().piEventReceived(be3); |
1403 this.myGraph.getThreadTable().piEventReceived(be3); |
1617 this.myGraph.getBinaryTable().piEventReceived(be3); |
1404 this.myGraph.getBinaryTable().piEventReceived(be3); |
1618 break; |
1405 break; |
1619 } |
1406 } |
1620 case Defines.FUNCTIONS_BINARIES: |
1407 case Defines.FUNCTIONS_BINARIES: |
1621 { |
1408 { |
1622 // get new counts and loads |
1409 trace.setFunctionBinary(graphIndex, adapter, this.myGraph.getProfiledBinaries()); |
1623 Vector<ProfiledGeneric> traceBinaries = trace.getIndexedBinaries(); |
|
1624 Vector<ProfiledGeneric> graphBinaries = this.myGraph.getProfiledBinaries(); |
|
1625 Hashtable<String,String> foundBinaries = new Hashtable<String,String>(); |
|
1626 |
|
1627 // previous binaries are not necessarily graphed this time |
|
1628 Enumeration<ProfiledGeneric> enu = graphBinaries.elements(); |
|
1629 while (enu.hasMoreElements()) { |
|
1630 ProfiledBinary pBinary = (ProfiledBinary) enu.nextElement(); |
|
1631 pBinary.setEnabled(graphIndex, false); |
|
1632 } |
|
1633 graphBinaries.clear(); |
|
1634 |
|
1635 ProfiledThreshold thresholdBinary = this.myGraph.getThresholdBinary(); |
|
1636 |
|
1637 if (thresholdBinary.isEnabled(graphIndex)) { |
|
1638 ArrayList<ProfiledGeneric> items = thresholdBinary.getItems(graphIndex); |
|
1639 // disable all items below the threshold |
|
1640 for (int i = 0; i < items.size(); i++) { |
|
1641 items.get(i).setEnabled(graphIndex, false); |
|
1642 } |
|
1643 } |
|
1644 |
|
1645 GppSample[] sortedSamples = trace.getSortedGppSamples(); |
|
1646 |
|
1647 // set up in case we find binaries below the threshold |
|
1648 boolean lowBinary; |
|
1649 thresholdBinary.init(graphIndex); |
|
1650 |
|
1651 int binaryThreshold = (Integer) NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountBinary"); //$NON-NLS-1$ |
|
1652 for (int i = startSampleIndex; i < endSampleIndex; i++) { |
|
1653 GppSample sample = sortedSamples[i]; |
|
1654 |
|
1655 ProfiledFunction pFunction = (ProfiledFunction) traceFunctions.elementAt(sample.functionIndex); |
|
1656 if (pFunction.isEnabled(graphIndex)) { |
|
1657 // binary list is based on functions |
|
1658 ProfiledBinary pBinary = (ProfiledBinary) traceBinaries.elementAt(sample.binaryIndex); |
|
1659 String binaryName = pBinary.getNameString(); |
|
1660 |
|
1661 lowBinary = pBinary.getTotalSampleCount() < binaryThreshold; |
|
1662 |
|
1663 if (!foundBinaries.containsKey(binaryName)) { |
|
1664 foundBinaries.put(binaryName, binaryName); |
|
1665 if (lowBinary) { |
|
1666 thresholdBinary.addItem(graphIndex, pBinary, 1); |
|
1667 } else { |
|
1668 pBinary.setEnabled(graphIndex, true); |
|
1669 pBinary.setSampleCount(graphIndex, 1); |
|
1670 graphBinaries.add(pBinary); |
|
1671 } |
|
1672 } else { |
|
1673 if (lowBinary) |
|
1674 thresholdBinary.incSampleCount(graphIndex); |
|
1675 else |
|
1676 pBinary.incSampleCount(graphIndex); |
|
1677 } |
|
1678 } |
|
1679 } |
|
1680 |
|
1681 // set the % load |
|
1682 for (int i = 0; i < graphBinaries.size(); i++) { |
|
1683 ProfiledBinary pBinary = (ProfiledBinary) graphBinaries.elementAt(i); |
|
1684 pBinary.setLoadAndString(graphIndex, (float)(pBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1685 } |
|
1686 thresholdBinary.setLoadAndString(graphIndex, |
|
1687 (float)(thresholdBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1688 |
1410 |
1689 // update the table items and redraw the table |
1411 // update the table items and redraw the table |
1690 this.myGraph.getBinaryTable().piEventReceived(be3); |
1412 this.myGraph.getBinaryTable().piEventReceived(be3); |
1691 break; |
1413 break; |
1692 } |
1414 } |
1693 case Defines.FUNCTIONS_BINARIES_THREADS: |
1415 case Defines.FUNCTIONS_BINARIES_THREADS: |
1694 { |
1416 { |
1695 // get new binary and thread counts and loads |
1417 // previous binaries are not necessarily graphed this time - reset |
1696 Vector<ProfiledGeneric> traceThreads = trace.getIndexedThreads(); |
1418 trace.setFunctionBinary(graphIndex, adapter, this.myGraph.getProfiledBinaries()); |
1697 Vector<ProfiledGeneric> traceBinaries = trace.getIndexedBinaries(); |
1419 // previous threads are not necessarily graphed this time - reset |
1698 Vector<ProfiledGeneric> graphThreads = this.myGraph.getProfiledThreads(); |
1420 trace.setFunctionBinaryThread(graphIndex, adapter, this.myGraph.getProfiledThreads()); |
1699 Vector<ProfiledGeneric> graphBinaries = this.myGraph.getProfiledBinaries(); |
|
1700 Hashtable<String,String> foundThreads = new Hashtable<String,String>(); |
|
1701 Hashtable<String,String> foundBinaries = new Hashtable<String,String>(); |
|
1702 |
|
1703 // previous threads are not necessarily graphed this time |
|
1704 Enumeration<ProfiledGeneric> enuThreads = graphThreads.elements(); |
|
1705 while (enuThreads.hasMoreElements()) { |
|
1706 ProfiledThread pThread = (ProfiledThread) enuThreads.nextElement(); |
|
1707 pThread.setEnabled(graphIndex, false); |
|
1708 } |
|
1709 graphThreads.clear(); |
|
1710 |
|
1711 ProfiledThreshold thresholdThread = this.myGraph.getThresholdThread(); |
|
1712 |
|
1713 if (thresholdThread.isEnabled(graphIndex)) { |
|
1714 ArrayList<ProfiledGeneric> items = thresholdThread.getItems(graphIndex); |
|
1715 // disable all items below the threshold |
|
1716 for (int i = 0; i < items.size(); i++) { |
|
1717 items.get(i).setEnabled(graphIndex, false); |
|
1718 } |
|
1719 } |
|
1720 |
|
1721 // previous binaries are not necessarily graphed this time |
|
1722 Enumeration<ProfiledGeneric> enuBinary = graphBinaries.elements(); |
|
1723 while (enuBinary.hasMoreElements()) { |
|
1724 ProfiledBinary pBinary = (ProfiledBinary) enuBinary.nextElement(); |
|
1725 pBinary.setEnabled(graphIndex, false); |
|
1726 } |
|
1727 graphBinaries.clear(); |
|
1728 |
|
1729 ProfiledThreshold thresholdBinary = this.myGraph.getThresholdBinary(); |
|
1730 |
|
1731 if (thresholdBinary.isEnabled(graphIndex)) { |
|
1732 ArrayList<ProfiledGeneric> items = thresholdBinary.getItems(graphIndex); |
|
1733 // disable all items below the threshold |
|
1734 for (int i = 0; i < items.size(); i++) { |
|
1735 items.get(i).setEnabled(graphIndex, false); |
|
1736 } |
|
1737 } |
|
1738 |
|
1739 GppSample[] sortedSamples = trace.getSortedGppSamples(); |
|
1740 |
|
1741 // set up in case we find threads below the threshold |
|
1742 boolean lowThread; |
|
1743 thresholdThread.init(graphIndex); |
|
1744 |
|
1745 // set up in case we find binaries below the threshold |
|
1746 boolean lowBinary; |
|
1747 thresholdBinary.init(graphIndex); |
|
1748 |
|
1749 int binaryThreshold = (Integer) NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountBinary"); //$NON-NLS-1$ |
|
1750 for (int i = startSampleIndex; i < endSampleIndex; i++) { |
|
1751 GppSample sample = sortedSamples[i]; |
|
1752 |
|
1753 ProfiledFunction pFunction = (ProfiledFunction) traceFunctions.elementAt(sample.functionIndex); |
|
1754 if (pFunction.isEnabled(graphIndex)) { |
|
1755 // binary list is based on |
|
1756 ProfiledBinary pBinary = (ProfiledBinary) traceBinaries.elementAt(sample.binaryIndex); |
|
1757 String binaryName = pBinary.getNameString(); |
|
1758 |
|
1759 lowBinary = pBinary.getTotalSampleCount() < binaryThreshold; |
|
1760 |
|
1761 if (!foundBinaries.containsKey(binaryName)) { |
|
1762 foundBinaries.put(binaryName, binaryName); |
|
1763 if (lowBinary) { |
|
1764 thresholdBinary.addItem(graphIndex, pBinary, 1); |
|
1765 } else { |
|
1766 pBinary.setEnabled(graphIndex, true); |
|
1767 pBinary.setSampleCount(graphIndex, 1); |
|
1768 graphBinaries.add(pBinary); |
|
1769 } |
|
1770 } else { |
|
1771 if (lowBinary) |
|
1772 thresholdBinary.incSampleCount(graphIndex); |
|
1773 else |
|
1774 pBinary.incSampleCount(graphIndex); |
|
1775 } |
|
1776 |
|
1777 // thread list is based on functions and binaries |
|
1778 ProfiledThread pThread = (ProfiledThread) traceThreads.elementAt(sample.threadIndex); |
|
1779 String threadName = pThread.getNameString(); |
|
1780 |
|
1781 lowThread = pThread.getTotalSampleCount() < (Integer)NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountThread"); //$NON-NLS-1$ |
|
1782 |
|
1783 if (!foundThreads.containsKey(threadName)) { |
|
1784 foundThreads.put(threadName, threadName); |
|
1785 if (lowThread) { |
|
1786 thresholdThread.addItem(graphIndex, pThread, 1); |
|
1787 } else { |
|
1788 pThread.setEnabled(graphIndex, true); |
|
1789 pThread.setSampleCount(graphIndex, 1); |
|
1790 graphThreads.add(pThread); |
|
1791 } |
|
1792 } else { |
|
1793 if (lowThread) |
|
1794 thresholdThread.incSampleCount(graphIndex); |
|
1795 else |
|
1796 pThread.incSampleCount(graphIndex); |
|
1797 } |
|
1798 } |
|
1799 } |
|
1800 |
|
1801 // set the % load |
|
1802 for (int i = 0; i < graphThreads.size(); i++) { |
|
1803 ProfiledThread pThread = (ProfiledThread) graphThreads.elementAt(i); |
|
1804 pThread.setLoadAndString(graphIndex, (float)(pThread.getSampleCount(graphIndex)*percentPerSample)); |
|
1805 } |
|
1806 thresholdThread.setLoadAndString(graphIndex, |
|
1807 (float)(thresholdThread.getSampleCount(graphIndex)*percentPerSample)); |
|
1808 |
|
1809 for (int i = 0; i < graphBinaries.size(); i++) { |
|
1810 ProfiledBinary pBinary = (ProfiledBinary) graphBinaries.elementAt(i); |
|
1811 pBinary.setLoadAndString(graphIndex, (float)(pBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1812 } |
|
1813 thresholdBinary.setLoadAndString(graphIndex, |
|
1814 (float)(thresholdBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1815 |
1421 |
1816 // update the table items and redraw the table |
1422 // update the table items and redraw the table |
1817 this.myGraph.getThreadTable().piEventReceived(be3); |
1423 this.myGraph.getThreadTable().piEventReceived(be3); |
1818 this.myGraph.getBinaryTable().piEventReceived(be3); |
1424 this.myGraph.getBinaryTable().piEventReceived(be3); |
1819 break; |
1425 break; |
1832 if (drawMode != Defines.FUNCTIONS_THREADS_BINARIES) |
1438 if (drawMode != Defines.FUNCTIONS_THREADS_BINARIES) |
1833 return; |
1439 return; |
1834 |
1440 |
1835 // we don't need to redraw the function table, since it has not changed |
1441 // we don't need to redraw the function table, since it has not changed |
1836 |
1442 |
1443 PIEvent be3 = new PIEvent(be.getValueObject(), PIEvent.SELECTION_AREA_CHANGED3); |
|
1837 GppTrace trace = (GppTrace)(this.myGraph.getTrace()); |
1444 GppTrace trace = (GppTrace)(this.myGraph.getTrace()); |
1838 Vector<ProfiledGeneric> traceThreads = trace.getIndexedThreads(); |
|
1839 |
|
1840 int graphIndex = this.myGraph.getGraphIndex(); |
1445 int graphIndex = this.myGraph.getGraphIndex(); |
1841 int startSampleIndex = trace.getStartSampleIndex(); |
1446 trace.setFunctionThreadBinary(graphIndex, adapter, this.myGraph.getProfiledBinaries()); |
1842 int endSampleIndex = trace.getEndSampleIndex(); |
|
1843 double percentPerSample; |
|
1844 if (startSampleIndex == endSampleIndex) |
|
1845 percentPerSample = 0.0; |
|
1846 else |
|
1847 percentPerSample = 100.0 / ((double)(endSampleIndex - startSampleIndex)); |
|
1848 |
|
1849 PIEvent be3 = new PIEvent(be.getValueObject(), PIEvent.SELECTION_AREA_CHANGED3); |
|
1850 |
|
1851 // get new binary counts and loads |
|
1852 Vector<ProfiledGeneric> traceBinaries = trace.getIndexedBinaries(); |
|
1853 Vector<ProfiledGeneric> graphBinaries = this.myGraph.getProfiledBinaries(); |
|
1854 Hashtable<String,String> foundBinaries = new Hashtable<String,String>(); |
|
1855 |
|
1856 // previous binaries are not necessarily graphed this time |
|
1857 Enumeration<ProfiledGeneric> enu = graphBinaries.elements(); |
|
1858 while (enu.hasMoreElements()) { |
|
1859 ProfiledBinary pBinary = (ProfiledBinary) enu.nextElement(); |
|
1860 pBinary.setEnabled(graphIndex, false); |
|
1861 } |
|
1862 graphBinaries.clear(); |
|
1863 |
|
1864 ProfiledThreshold thresholdBinary = this.myGraph.getThresholdBinary(); |
|
1865 |
|
1866 if (thresholdBinary.isEnabled(graphIndex)) { |
|
1867 ArrayList<ProfiledGeneric> items = thresholdBinary.getItems(graphIndex); |
|
1868 // disable all items below the threshold |
|
1869 for (int i = 0; i < items.size(); i++) { |
|
1870 items.get(i).setEnabled(graphIndex, false); |
|
1871 } |
|
1872 } |
|
1873 |
|
1874 GppSample[] sortedSamples = trace.getSortedGppSamples(); |
|
1875 |
|
1876 // set up in case we find binaries below the threshold |
|
1877 boolean lowBinary; |
|
1878 thresholdBinary.init(graphIndex); |
|
1879 |
|
1880 int binaryThreshold = (Integer) NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountBinary"); //$NON-NLS-1$ |
|
1881 for (int i = startSampleIndex; i < endSampleIndex; i++) { |
|
1882 GppSample sample = sortedSamples[i]; |
|
1883 |
|
1884 ProfiledThread pThread = (ProfiledThread) traceThreads.elementAt(sample.threadIndex); |
|
1885 if (pThread.isEnabled(graphIndex)) { |
|
1886 // binary list is based on threads |
|
1887 ProfiledBinary pBinary = (ProfiledBinary) traceBinaries.elementAt(sample.binaryIndex); |
|
1888 String binaryName = pBinary.getNameString(); |
|
1889 |
|
1890 lowBinary = pBinary.getTotalSampleCount() < binaryThreshold; |
|
1891 |
|
1892 if (!foundBinaries.containsKey(binaryName)) { |
|
1893 foundBinaries.put(binaryName, binaryName); |
|
1894 if (lowBinary) { |
|
1895 thresholdBinary.addItem(graphIndex, pBinary, 1); |
|
1896 } else { |
|
1897 pBinary.setEnabled(graphIndex, true); |
|
1898 pBinary.setSampleCount(graphIndex, 1); |
|
1899 graphBinaries.add(pBinary); |
|
1900 } |
|
1901 } else { |
|
1902 if (lowBinary) |
|
1903 thresholdBinary.incSampleCount(graphIndex); |
|
1904 else |
|
1905 pBinary.incSampleCount(graphIndex); |
|
1906 } |
|
1907 } |
|
1908 } |
|
1909 |
|
1910 // set the % load |
|
1911 for (int i = 0; i < graphBinaries.size(); i++) { |
|
1912 ProfiledBinary pBinary = (ProfiledBinary) graphBinaries.elementAt(i); |
|
1913 pBinary.setLoadAndString(graphIndex, (float)(pBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1914 } |
|
1915 thresholdBinary.setLoadAndString(graphIndex, |
|
1916 (float)(thresholdBinary.getSampleCount(graphIndex)*percentPerSample)); |
|
1917 |
1447 |
1918 // update the table items and redraw the table |
1448 // update the table items and redraw the table |
1919 this.myGraph.getBinaryTable().piEventReceived(be3); |
1449 this.myGraph.getBinaryTable().piEventReceived(be3); |
1920 } |
1450 } |
1921 else if (be.getType() == PIEvent.CHANGED_BINARY_TABLE) |
1451 else if (be.getType() == PIEvent.CHANGED_BINARY_TABLE) |
1926 if (drawMode != Defines.FUNCTIONS_BINARIES_THREADS) |
1456 if (drawMode != Defines.FUNCTIONS_BINARIES_THREADS) |
1927 return; |
1457 return; |
1928 |
1458 |
1929 // we don't need to redraw the function table, since it has not changed |
1459 // we don't need to redraw the function table, since it has not changed |
1930 |
1460 |
1461 PIEvent be3 = new PIEvent(be.getValueObject(), PIEvent.SELECTION_AREA_CHANGED3); |
|
1931 GppTrace trace = (GppTrace)(this.myGraph.getTrace()); |
1462 GppTrace trace = (GppTrace)(this.myGraph.getTrace()); |
1932 Vector<ProfiledGeneric> traceBinaries = trace.getIndexedBinaries(); |
|
1933 |
|
1934 int graphIndex = this.myGraph.getGraphIndex(); |
1463 int graphIndex = this.myGraph.getGraphIndex(); |
1935 int startSampleIndex = trace.getStartSampleIndex(); |
1464 trace.setFunctionBinaryThread(graphIndex, adapter, this.myGraph.getProfiledThreads()); |
1936 int endSampleIndex = trace.getEndSampleIndex(); |
|
1937 double percentPerSample; |
|
1938 if (startSampleIndex == endSampleIndex) |
|
1939 percentPerSample = 0.0; |
|
1940 else |
|
1941 percentPerSample = 100.0 / ((double)(endSampleIndex - startSampleIndex)); |
|
1942 |
|
1943 PIEvent be3 = new PIEvent(be.getValueObject(), PIEvent.SELECTION_AREA_CHANGED3); |
|
1944 |
|
1945 // get new thread counts and loads |
|
1946 Vector<ProfiledGeneric> traceThreads = trace.getIndexedThreads(); |
|
1947 Vector<ProfiledGeneric> graphThreads = this.myGraph.getProfiledThreads(); |
|
1948 Hashtable<String,String> foundThreads = new Hashtable<String,String>(); |
|
1949 |
|
1950 // previous threads are not necessarily graphed this time |
|
1951 Enumeration<ProfiledGeneric> enu = graphThreads.elements(); |
|
1952 while (enu.hasMoreElements()) { |
|
1953 ProfiledThread pThread = (ProfiledThread) enu.nextElement(); |
|
1954 pThread.setEnabled(graphIndex, false); |
|
1955 } |
|
1956 graphThreads.clear(); |
|
1957 |
|
1958 ProfiledThreshold thresholdThread = this.myGraph.getThresholdThread(); |
|
1959 |
|
1960 if (thresholdThread.isEnabled(graphIndex)) { |
|
1961 ArrayList<ProfiledGeneric> items = thresholdThread.getItems(graphIndex); |
|
1962 // disable all items below the threshold |
|
1963 for (int i = 0; i < items.size(); i++) { |
|
1964 items.get(i).setEnabled(graphIndex, false); |
|
1965 } |
|
1966 } |
|
1967 |
|
1968 GppSample[] sortedSamples = trace.getSortedGppSamples(); |
|
1969 |
|
1970 // set up in case we find threads below the threshold |
|
1971 boolean lowThread; |
|
1972 thresholdThread.init(graphIndex); |
|
1973 |
|
1974 int threadThreshold = (Integer) NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.thresholdCountThread"); //$NON-NLS-1$ |
|
1975 for (int i = startSampleIndex; i < endSampleIndex; i++) { |
|
1976 GppSample sample = sortedSamples[i]; |
|
1977 |
|
1978 ProfiledBinary pBinary = (ProfiledBinary) traceBinaries.elementAt(sample.binaryIndex); |
|
1979 if (pBinary.isEnabled(graphIndex)) { |
|
1980 // thread list is based on binaries |
|
1981 ProfiledThread pThread = (ProfiledThread) traceThreads.elementAt(sample.threadIndex); |
|
1982 String threadName = pThread.getNameString(); |
|
1983 |
|
1984 lowThread = pThread.getTotalSampleCount() < threadThreshold; |
|
1985 |
|
1986 if (!foundThreads.containsKey(threadName)) { |
|
1987 foundThreads.put(threadName, threadName); |
|
1988 if (lowThread) { |
|
1989 thresholdThread.addItem(graphIndex, pThread, 1); |
|
1990 } else { |
|
1991 pThread.setEnabled(graphIndex, true); |
|
1992 pThread.setSampleCount(graphIndex, 1); |
|
1993 graphThreads.add(pThread); |
|
1994 } |
|
1995 } else { |
|
1996 if (lowThread) |
|
1997 thresholdThread.incSampleCount(graphIndex); |
|
1998 else |
|
1999 pThread.incSampleCount(graphIndex); |
|
2000 } |
|
2001 } |
|
2002 } |
|
2003 |
|
2004 // set the % load |
|
2005 for (int i = 0; i < graphThreads.size(); i++) { |
|
2006 ProfiledThread pThread = (ProfiledThread) graphThreads.elementAt(i); |
|
2007 pThread.setLoadAndString(graphIndex, (float)(pThread.getSampleCount(graphIndex)*percentPerSample)); |
|
2008 } |
|
2009 thresholdThread.setLoadAndString(graphIndex, |
|
2010 (float)(thresholdThread.getSampleCount(graphIndex)*percentPerSample)); |
|
2011 |
1465 |
2012 // update the table items and redraw the table |
1466 // update the table items and redraw the table |
2013 this.myGraph.getThreadTable().piEventReceived(be3); |
1467 this.myGraph.getThreadTable().piEventReceived(be3); |
2014 } |
1468 } |
2015 } |
1469 } |
2039 if (!(event.getElement() instanceof ProfiledGeneric)) |
1493 if (!(event.getElement() instanceof ProfiledGeneric)) |
2040 return; |
1494 return; |
2041 |
1495 |
2042 // set the stored value to the checkbox value |
1496 // set the stored value to the checkbox value |
2043 ProfiledGeneric pg = (ProfiledGeneric)event.getElement(); |
1497 ProfiledGeneric pg = (ProfiledGeneric)event.getElement(); |
2044 pg.setEnabled(myGraph.getGraphIndex(), event.getChecked()); |
1498 pg.setEnabled(myGraph.getGraphIndex(), event.getChecked()); |
2045 |
1499 |
2046 // this table's set of checkbox-selected rows has changed, so propagate that information |
1500 // this table's set of checkbox-selected rows has changed, so propagate that information |
2047 setSelectedNames(); |
1501 setSelectedNames(); |
2048 |
1502 |
2049 if ( (pg.getSampleCount(myGraph.getGraphIndex()) != 0) |
1503 if ( (pg.getSampleCount(myGraph.getGraphIndex()) != 0) |
2096 quickSort(sortColumn, profiledFunctions); |
1550 quickSort(sortColumn, profiledFunctions); |
2097 } |
1551 } |
2098 |
1552 |
2099 private class ColumnSelectionHandler extends SelectionAdapter |
1553 private class ColumnSelectionHandler extends SelectionAdapter |
2100 { |
1554 { |
1555 @Override |
|
2101 public void widgetSelected(SelectionEvent e) |
1556 public void widgetSelected(SelectionEvent e) |
2102 { |
1557 { |
2103 // wait for the previous sort to finish |
1558 // wait for the previous sort to finish |
2104 if (sorting || !(e.widget instanceof TableColumn)) |
1559 if (sorting || !(e.widget instanceof TableColumn)) |
2105 return; |
1560 return; |
2106 |
1561 |
2107 sortOnColumnSelection((TableColumn) e.widget); |
1562 sortOnColumnSelection((TableColumn) e.widget); |
2108 } |
1563 } |
2109 } |
1564 } |
2110 |
1565 |
1566 /** |
|
1567 * Adds ProfiledGenerics and threshold items to the table data |
|
1568 * (this.tableItemData and this.profiledThreads). Sorts the ProfiledGenerics |
|
1569 * according to load; and sets the graph's sorted list accordingly. Refreshes |
|
1570 * the TableViewer if parameter setInput is true. |
|
1571 * |
|
1572 * @param setInput |
|
1573 * if true, reset the TableViewer |
|
1574 */ |
|
2111 public void updateProfiledAndItemData(boolean setInput) |
1575 public void updateProfiledAndItemData(boolean setInput) |
2112 { |
1576 { |
2113 tableItemData.clear(); |
1577 tableItemData.clear(); |
2114 profiledFunctions.clear(); |
1578 profiledFunctions.clear(); |
2115 |
1579 |
2120 ProfiledFunction nextElement = (ProfiledFunction)enu.nextElement(); |
1584 ProfiledFunction nextElement = (ProfiledFunction)enu.nextElement(); |
2121 tableItemData.add(nextElement); |
1585 tableItemData.add(nextElement); |
2122 profiledFunctions.add(nextElement); |
1586 profiledFunctions.add(nextElement); |
2123 } |
1587 } |
2124 |
1588 |
2125 if (myGraph.getThresholdFunction().getItemCount(myGraph.getGraphIndex()) != 0) { |
1589 if (myGraph.getThresholdFunction().getItemCount() != 0) { |
2126 tableItemData.add(myGraph.getThresholdFunction()); |
1590 tableItemData.add(myGraph.getThresholdFunction()); |
2127 profiledFunctions.add(myGraph.getThresholdFunction()); |
1591 profiledFunctions.add(myGraph.getThresholdFunction()); |
2128 } |
1592 } |
2129 |
1593 |
2130 // now sort the items in increasing total sample count, so that they graph correctly |
1594 // now sort the items in increasing total sample count, so that they graph correctly |
2132 Arrays.sort(sorted, new Comparator<Object>() { |
1596 Arrays.sort(sorted, new Comparator<Object>() { |
2133 |
1597 |
2134 public int compare(Object arg0, Object arg1) |
1598 public int compare(Object arg0, Object arg1) |
2135 { |
1599 { |
2136 if (arg0 instanceof ProfiledGeneric && arg1 instanceof ProfiledGeneric) |
1600 if (arg0 instanceof ProfiledGeneric && arg1 instanceof ProfiledGeneric) |
2137 return ((ProfiledGeneric)arg0).getTotalSampleCount() - |
1601 return (adapter.getTotalSampleCount((ProfiledGeneric)arg0)) - |
2138 ((ProfiledGeneric)arg1).getTotalSampleCount(); |
1602 adapter.getTotalSampleCount(((ProfiledGeneric)arg1)); |
2139 else |
1603 return 0; |
2140 return 0; |
|
2141 } |
1604 } |
2142 }); |
1605 }); |
2143 |
1606 |
2144 // now create the sorted list used to draw the graph |
1607 // now create the sorted list used to draw the graph |
2145 myGraph.getSortedFunctions().clear(); |
1608 myGraph.getSortedFunctions().clear(); |
2146 |
1609 |
2147 if (myGraph.getThresholdFunction().getItemCount(myGraph.getGraphIndex()) != 0) |
1610 if (myGraph.getThresholdFunction().getItemCount() != 0) |
2148 myGraph.getSortedFunctions().add(myGraph.getThresholdFunction()); |
1611 myGraph.getSortedFunctions().add(myGraph.getThresholdFunction()); |
2149 |
1612 |
2150 for (int i = 0; i < sorted.length; i++) |
1613 for (int i = 0; i < sorted.length; i++) |
2151 myGraph.getSortedFunctions().add((ProfiledGeneric) sorted[i]); |
1614 myGraph.getSortedFunctions().add((ProfiledGeneric) sorted[i]); |
2152 |
1615 |
2258 |
1721 |
2259 refreshTableViewer(); |
1722 refreshTableViewer(); |
2260 this.sorting = false; |
1723 this.sorting = false; |
2261 } |
1724 } |
2262 |
1725 |
2263 protected Menu getTableMenu(Decorations parent, int graphIndex, int drawMode) { |
1726 @Override |
1727 protected Menu getTableMenu(Decorations aParent, int graphIndex, int drawMode) { |
|
2264 // get rid of last Menu created so we don't have double menu |
1728 // get rid of last Menu created so we don't have double menu |
2265 // in on click |
1729 // in on click |
2266 if (contextMenu != null) { |
1730 if (contextMenu != null) { |
2267 contextMenu.dispose(); |
1731 contextMenu.dispose(); |
2268 } |
1732 } |
2269 |
1733 |
2270 contextMenu = new Menu(parent, SWT.POP_UP); |
1734 contextMenu = new Menu(aParent, SWT.POP_UP); |
2271 |
1735 |
2272 // Use drawMode to determine the drill down items and |
1736 // Use drawMode to determine the drill down items and |
2273 // whether to show a color column |
1737 // whether to show a color column |
2274 addDrillDownItems(contextMenu, drawMode); |
1738 addDrillDownItems(contextMenu, drawMode); |
2275 |
1739 |
2381 contextMenu.setVisible(true); |
1845 contextMenu.setVisible(true); |
2382 |
1846 |
2383 return contextMenu; |
1847 return contextMenu; |
2384 } |
1848 } |
2385 |
1849 |
2386 public Vector getTableItemData() { |
1850 public Vector<ProfiledGeneric> getTableItemData() { |
2387 return this.tableItemData; |
1851 return this.tableItemData; |
2388 } |
1852 } |
2389 |
1853 |
2390 } |
1854 } |