sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.address/src/com/nokia/carbide/cpp/pi/address/AddressPlugin.java
changeset 2 b9ab3b238396
child 5 844b047e260d
equal deleted inserted replaced
1:1050670c6980 2:b9ab3b238396
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.carbide.cpp.pi.address;
       
    19 
       
    20 import java.io.File;
       
    21 import java.io.IOException;
       
    22 import java.io.Serializable;
       
    23 import java.util.ArrayList;
       
    24 import java.util.Enumeration;
       
    25 import java.util.Hashtable;
       
    26 import java.util.Vector;
       
    27 
       
    28 import org.eclipse.jface.action.Action;
       
    29 import org.eclipse.jface.action.MenuManager;
       
    30 import org.eclipse.jface.action.Separator;
       
    31 import org.eclipse.jface.resource.ImageDescriptor;
       
    32 import org.eclipse.swt.SWT;
       
    33 import org.eclipse.swt.events.SelectionAdapter;
       
    34 import org.eclipse.swt.events.SelectionEvent;
       
    35 import org.eclipse.swt.graphics.Color;
       
    36 import org.eclipse.swt.graphics.RGB;
       
    37 import org.eclipse.swt.layout.FillLayout;
       
    38 import org.eclipse.swt.widgets.Composite;
       
    39 import org.eclipse.swt.widgets.Display;
       
    40 import org.eclipse.swt.widgets.Event;
       
    41 import org.eclipse.swt.widgets.FileDialog;
       
    42 import org.eclipse.swt.widgets.Shell;
       
    43 import org.eclipse.swt.widgets.Text;
       
    44 import org.eclipse.ui.PlatformUI;
       
    45 import org.osgi.framework.BundleContext;
       
    46 
       
    47 import com.nokia.carbide.cpp.internal.pi.actions.SetThresholdsDialog;
       
    48 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository;
       
    49 import com.nokia.carbide.cpp.internal.pi.analyser.ProfileVisualiser;
       
    50 import com.nokia.carbide.cpp.internal.pi.model.FunctionResolver;
       
    51 import com.nokia.carbide.cpp.internal.pi.model.GenericSample;
       
    52 import com.nokia.carbide.cpp.internal.pi.model.GenericTrace;
       
    53 import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData;
       
    54 import com.nokia.carbide.cpp.internal.pi.model.ProfiledBinary;
       
    55 import com.nokia.carbide.cpp.internal.pi.model.ProfiledFunction;
       
    56 import com.nokia.carbide.cpp.internal.pi.model.ProfiledGeneric;
       
    57 import com.nokia.carbide.cpp.internal.pi.model.ProfiledThread;
       
    58 import com.nokia.carbide.cpp.internal.pi.model.TraceDataRepository;
       
    59 import com.nokia.carbide.cpp.internal.pi.plugin.model.AbstractPiPlugin;
       
    60 import com.nokia.carbide.cpp.internal.pi.plugin.model.IClassReplacer;
       
    61 import com.nokia.carbide.cpp.internal.pi.plugin.model.IEventListener;
       
    62 import com.nokia.carbide.cpp.internal.pi.plugin.model.IRecordable;
       
    63 import com.nokia.carbide.cpp.internal.pi.plugin.model.IReportable;
       
    64 import com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace;
       
    65 import com.nokia.carbide.cpp.internal.pi.plugin.model.IViewMenu;
       
    66 import com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable;
       
    67 import com.nokia.carbide.cpp.internal.pi.resolvers.SymbolFileFunctionResolver;
       
    68 import com.nokia.carbide.cpp.internal.pi.test.AnalysisInfoHandler;
       
    69 import com.nokia.carbide.cpp.internal.pi.utils.PIUtilities;
       
    70 import com.nokia.carbide.cpp.internal.pi.visual.Defines;
       
    71 import com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph;
       
    72 import com.nokia.carbide.cpp.internal.pi.visual.GraphDrawRequest;
       
    73 import com.nokia.carbide.cpp.internal.pi.visual.PIEvent;
       
    74 import com.nokia.carbide.cpp.pi.core.SessionPreferences;
       
    75 import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
       
    76 import com.nokia.carbide.cpp.pi.importer.SampleImporter;
       
    77 import com.nokia.carbide.cpp.pi.util.ColorPalette;
       
    78 import com.nokia.carbide.cpp.pi.util.GeneralMessages;
       
    79 
       
    80 
       
    81 /**
       
    82  * The main plugin class to be used in the desktop.
       
    83  */
       
    84 public class AddressPlugin extends AbstractPiPlugin
       
    85 		implements ITrace, IViewMenu, IClassReplacer, //IExportItem,
       
    86 					IReportable, IRecordable, IVisualizable, IEventListener
       
    87 {
       
    88 	private static final String HELP_CONTEXT_ID = PIPageEditor.PI_ID + ".address";  //$NON-NLS-1$
       
    89 	
       
    90 //	private static HashMap<Integer,Long> uidToAddrThreadPeriod = new HashMap<Integer,Long>();
       
    91 
       
    92 	// There will be three graphs - one each for editor pages 0, 1, 2
       
    93 	// This code assumes that page 0 has the threads graph, 1 the binaries, and 2 the functions
       
    94 	private final static int GRAPH_COUNT = 3;
       
    95 	private boolean pagesCreated = false;
       
    96 
       
    97 	// The shared instance.
       
    98 	private static AddressPlugin plugin;
       
    99 
       
   100 	private int functionsShown = 10;
       
   101 
       
   102 	// string that should contain the maximum number of functions to display
       
   103 	private String functionCountString;
       
   104 
       
   105 	private static void setPlugin(AddressPlugin newPlugin)
       
   106 	{
       
   107 		plugin = newPlugin;
       
   108 	}
       
   109 
       
   110 	/**
       
   111 	 * The constructor.
       
   112 	 */
       
   113 	public AddressPlugin() {
       
   114 		super();
       
   115 		setPlugin(this);
       
   116 	}
       
   117 
       
   118 	public Class getTraceClass()
       
   119 	{
       
   120 		return GppTrace.class;
       
   121 	}
       
   122 
       
   123 	public Class getReplacedClass(String className)
       
   124 	{
       
   125 		if (   className.indexOf("com.nokia.carbide.cpp.pi.address.GppTrace") != -1 //$NON-NLS-1$
       
   126 			|| className.indexOf("fi.vtt.bappea.model.GppTrace") != -1 //$NON-NLS-1$
       
   127 			|| className.indexOf("com.nokia.carbide.pi.address.GppTrace") != -1 //$NON-NLS-1$
       
   128 			|| className.indexOf("fi.vtt.bappea.gppTracePlugin.GppTrace") != -1) //$NON-NLS-1$
       
   129 		{
       
   130 			return GppTrace.class;
       
   131 		}
       
   132 		else if (   className.indexOf("com.nokia.carbide.cpp.pi.address.GppSample") != -1 //$NON-NLS-1$
       
   133 				 || className.indexOf("com.nokia.carbide.pi.address.GppSample") != -1 //$NON-NLS-1$
       
   134 				 || className.indexOf("fi.vtt.bappea.model.GppSample") != -1 //$NON-NLS-1$
       
   135 				 || className.indexOf("fi.vtt.bappea.gppTracePlugin.GppSample") != -1) //$NON-NLS-1$
       
   136 		{
       
   137 			return GppSample.class;
       
   138 		}
       
   139 		else if (   className.indexOf("com.nokia.carbide.cpp.pi.address.GppThread") != -1 //$NON-NLS-1$
       
   140 				 || className.indexOf("com.nokia.carbide.pi.address.GppThread") != -1 //$NON-NLS-1$
       
   141 				 || className.indexOf("fi.vtt.bappea.model.GppThread") != -1 //$NON-NLS-1$
       
   142 				 || className.indexOf("fi.vtt.bappea.gppTracePlugin.GppThread") != -1) //$NON-NLS-1$
       
   143 		{
       
   144 			return GppThread.class;
       
   145 		}
       
   146 		else if (   className.indexOf("com.nokia.carbide.cpp.pi.address.GppProcess") != -1 //$NON-NLS-1$
       
   147 				 || className.indexOf("com.nokia.carbide.pi.address.GppProcess") != -1 //$NON-NLS-1$
       
   148 				 || className.indexOf("fi.vtt.bappea.model.GppProcess") != -1 //$NON-NLS-1$
       
   149 				 || className.indexOf("fi.vtt.bappea.gppTracePlugin.GppProcess") != -1) //$NON-NLS-1$
       
   150 		{
       
   151 			return GppProcess.class;
       
   152 		}
       
   153 		else
       
   154 		{
       
   155 			return null;
       
   156 		}
       
   157 	}
       
   158 
       
   159 	public void initialiseTrace(GenericTrace genericTrace)
       
   160 	{
       
   161 		if (!(genericTrace instanceof GppTrace))
       
   162 			return;
       
   163 
       
   164 		GppTrace trace = (GppTrace)genericTrace;
       
   165 		
       
   166 		NpiInstanceRepository.getInstance().activeUidAddTrace("com.nokia.carbide.cpp.pi.address", trace); //$NON-NLS-1$
       
   167 		
       
   168 		// initialize the address/thread base sampling rate
       
   169 		int samplingInterval = 1;
       
   170 		if (trace.samples.size() > 2) {
       
   171 			// because of a problem in older samplers, the first address/thread sample may have been thrown out
       
   172 			samplingInterval = (int) (((GppSample) trace.samples.get(1)).sampleSynchTime - ((GppSample) trace.samples.get(0)).sampleSynchTime); 
       
   173 		}
       
   174 			
       
   175 		NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.samplingInterval", new Integer(samplingInterval)); //$NON-NLS-1$
       
   176 		
       
   177 		// make sure that the sorted samples array exists
       
   178 		if (trace.getSortedGppSamples() == null)
       
   179 			trace.sortGppSamples();
       
   180 
       
   181 		GppTraceGraph.refreshDataFromTrace(trace);
       
   182 		PIPageEditor.setTime(0.0f, 0.0f);
       
   183 		long lastSampleTime = trace.getSample(trace.samples.size() - 1).sampleSynchTime;
       
   184 		PIPageEditor.currentPageEditor().setMaxEndTime(((double)lastSampleTime) / 1000.0f);
       
   185 	}
       
   186 
       
   187 	public GppTrace getTrace()
       
   188 	{
       
   189 		return (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   190 	}
       
   191 
       
   192 	public GenericTraceGraph getTraceGraph(int graphIndex)
       
   193 	{
       
   194 		GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   195 		
       
   196 		if (trace != null) {
       
   197 			int uid = NpiInstanceRepository.getInstance().activeUid();
       
   198 			return trace.getTraceGraph(graphIndex, uid);
       
   199 		} else
       
   200 			return null;
       
   201 	}
       
   202 
       
   203 	public GenericTrace getTrace(int graphIndex)
       
   204 	{	
       
   205 		return (GenericTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   206 	}
       
   207 	
       
   208 /*
       
   209 	public GenericTraceGraph getTraceGraph(int graphIndex, int uid)
       
   210 	{	
       
   211 		GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   212 
       
   213 		// if we already had it, then we can pass in the formatted trace data
       
   214 		return trace.getTraceGraph(graphIndex, uid);
       
   215 	}
       
   216 */
       
   217 	
       
   218 	public Integer getLastSample(int graphIndex)
       
   219 	{
       
   220 		GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   221 
       
   222 		if (trace == null)
       
   223 			return null;
       
   224 
       
   225 	  	//this sets GPP thread list visible by default
       
   226 	  	((GppTraceGraph)trace.getTraceGraph(graphIndex)).piEventReceived(new PIEvent(null, PIEvent.MOUSE_PRESSED));
       
   227 
       
   228 	  	return new Integer(trace.getLastSampleNumber());
       
   229 	}
       
   230 
       
   231 	public GraphDrawRequest getDrawRequest(int graphIndex) {
       
   232 		return null;
       
   233 	}
       
   234 
       
   235 	public void receiveSelectionEvent(String eventString)
       
   236 	{
       
   237 		if (eventString == null)
       
   238 			return;
       
   239 
       
   240 		int currentPage = PIPageEditor.currentPageIndex();
       
   241 
       
   242 		if (   (currentPage != PIPageEditor.THREADS_PAGE)
       
   243 			&& (currentPage != PIPageEditor.BINARIES_PAGE)
       
   244 			&& (currentPage != PIPageEditor.FUNCTIONS_PAGE))
       
   245 			  return;
       
   246 		
       
   247 		GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   248 		
       
   249 		if (eventString.equals("fillSelected")) //$NON-NLS-1$
       
   250 	    {
       
   251 	    	PIEvent be = new PIEvent(null, PIEvent.SET_FILL_SELECTED_THREAD);
       
   252 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.THREADS_PAGE)).piEventReceived(be);
       
   253 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.BINARIES_PAGE)).piEventReceived(be);
       
   254 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE)).piEventReceived(be);
       
   255 	    	
       
   256 	    	NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.fillAll", Boolean.FALSE); //$NON-NLS-1$
       
   257 	    }
       
   258 		else if (eventString.equals("fillAll")) //$NON-NLS-1$
       
   259 		{
       
   260 			PIEvent be = new PIEvent(null, PIEvent.SET_FILL_ALL_THREADS);
       
   261 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.THREADS_PAGE)).piEventReceived(be);
       
   262 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.BINARIES_PAGE)).piEventReceived(be);
       
   263 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE)).piEventReceived(be);
       
   264 	    	
       
   265 	    	NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.fillAll", Boolean.TRUE); //$NON-NLS-1$
       
   266 		}
       
   267 		else if (eventString.equals("fillNone")) //$NON-NLS-1$
       
   268 		{
       
   269 			PIEvent be = new PIEvent(null, PIEvent.SET_FILL_OFF);
       
   270 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.THREADS_PAGE)).piEventReceived(be);
       
   271 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.BINARIES_PAGE)).piEventReceived(be);
       
   272 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE)).piEventReceived(be);
       
   273 	    	
       
   274 	    	NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.fillAll", Boolean.FALSE); //$NON-NLS-1$
       
   275 		}
       
   276 		else if (eventString.equals("setBarOn")) //$NON-NLS-1$
       
   277 		{
       
   278 			PIEvent be = new PIEvent(null, PIEvent.GPP_SET_BAR_GRAPH_ON);
       
   279 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.THREADS_PAGE)).piEventReceived(be);
       
   280 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.BINARIES_PAGE)).piEventReceived(be);
       
   281 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE)).piEventReceived(be);
       
   282 	    	
       
   283 	    	NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.bar", Boolean.TRUE); //$NON-NLS-1$
       
   284 		}
       
   285 		else if (eventString.equals("setBarOff")) //$NON-NLS-1$
       
   286 		{
       
   287 			PIEvent be = new PIEvent(null, PIEvent.GPP_SET_BAR_GRAPH_OFF);
       
   288 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.THREADS_PAGE)).piEventReceived(be);
       
   289 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.BINARIES_PAGE)).piEventReceived(be);
       
   290 	    	((GppTraceGraph)trace.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE)).piEventReceived(be);
       
   291 	    	
       
   292 	    	NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.bar", Boolean.FALSE); //$NON-NLS-1$
       
   293 		}
       
   294 	  	else if (eventString.equals("resetToCurrentMode")) //$NON-NLS-1$
       
   295 	  	{
       
   296 	  		((GppTraceGraph)trace.getTraceGraph(currentPage)).action(eventString);
       
   297 	  	}
       
   298 	}
       
   299 
       
   300 	public String getTraceName() {
       
   301 		return "Address/Thread";	//$NON-NLS-1$
       
   302 	}
       
   303 
       
   304 	public int getTraceId() {
       
   305 		return 1;
       
   306 	}
       
   307 
       
   308 	public ParsedTraceData parseTraceFile(File file /*, ProgressBar progressBar*/) throws IOException
       
   309 	{
       
   310 //		progressBar.setString("Parsing address and thread trace");
       
   311 
       
   312         GppTraceParser gppParser = new GppTraceParser();
       
   313         ParsedTraceData parsed = gppParser.parse(file);
       
   314         SymbolFileFunctionResolver sffp = this.resolveSymbolFileParser(/*progressBar*/);
       
   315 
       
   316         parsed.functionResolvers = new FunctionResolver[]{sffp};
       
   317 
       
   318         return parsed;
       
   319 	}
       
   320 
       
   321 	private SymbolFileFunctionResolver resolveSymbolFileParser(/*ProgressBar progressBar*/)
       
   322     {
       
   323         //        	progressBar.setString("Parsing symbol file");
       
   324         //reads the symbol name path from configuration data
       
   325         File symbolFile = new File(
       
   326         		SampleImporter.getInstance().getRomSymbolFile());
       
   327 
       
   328         SymbolFileFunctionResolver sffp = new SymbolFileFunctionResolver();
       
   329         sffp.parseAndProcessSymbolFile(symbolFile);
       
   330         return sffp;
       
   331     }
       
   332 
       
   333 	public Hashtable<Integer,Object> getSummaryTable(double startTime, double endTime)
       
   334 	{
       
   335 		if (plugin == null)
       
   336 			return null;
       
   337 
       
   338 		// This code relies on currentPage being the same as graphIndex
       
   339 		int currentPage = PIPageEditor.currentPageIndex();
       
   340 
       
   341 		if (   (currentPage != PIPageEditor.THREADS_PAGE)
       
   342 			&& (currentPage != PIPageEditor.BINARIES_PAGE)
       
   343 			&& (currentPage != PIPageEditor.FUNCTIONS_PAGE))
       
   344 			  return null;
       
   345 
       
   346 		GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   347 
       
   348 		Hashtable<Integer,Object> summary = new Hashtable<Integer,Object>();
       
   349 		Enumeration<ProfiledGeneric> e = trace.getSortedThreadsElements();
       
   350 		while (e.hasMoreElements())
       
   351 		{
       
   352 			Vector<Object> data = new Vector<Object>();
       
   353 			ProfiledThread pt = (ProfiledThread)e.nextElement();
       
   354 			data.add(pt.getNameString());
       
   355 			data.add(pt.getAverageLoadValueString(currentPage));
       
   356 			summary.put(new Integer(pt.getThreadId()), data);
       
   357 		}
       
   358 		return summary;
       
   359 	}
       
   360 
       
   361 	public String getGeneralInfo()
       
   362 	{
       
   363 		return null;
       
   364 	}
       
   365 
       
   366 	public ArrayList<String> getColumnNames()
       
   367 	{
       
   368 		ArrayList<String> names = new ArrayList<String>();
       
   369 		names.add(Messages.getString("AddressPlugin.0"));  //$NON-NLS-1$
       
   370 		names.add(Messages.getString("AddressPlugin.1"));  //$NON-NLS-1$
       
   371 		return names;
       
   372 	}
       
   373 
       
   374 	public ArrayList<Boolean> getColumnSortTypes()
       
   375 	{
       
   376 		ArrayList<Boolean> sortTypes = new ArrayList<Boolean>();
       
   377 		sortTypes.add(SORT_BY_NAME);
       
   378 		sortTypes.add(SORT_BY_NUMBER);
       
   379 		return sortTypes;
       
   380 	}
       
   381 
       
   382 	public String getActiveInfo(Object key, double startTime, double endTime)
       
   383 	{
       
   384 		int threadId;
       
   385 		if (key instanceof Integer)
       
   386 			threadId = ((Integer)key).intValue();
       
   387 		else
       
   388 			return null;
       
   389 		String threadName = ""; //$NON-NLS-1$
       
   390 		Hashtable<Integer,Object> tmpTable = this.getSummaryTable(startTime, endTime);
       
   391 		if (tmpTable != null)
       
   392 		{
       
   393 			threadName = (String)((Vector<Object>)tmpTable.get(key)).elementAt(0);
       
   394 		}
       
   395 
       
   396 		GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   397 
       
   398 		Vector<GenericSample> samples = trace.getSamplesInsideTimePeriod((long)startTime, (long)endTime);
       
   399 		Hashtable<String,Integer> functionLoad = new Hashtable<String,Integer>();
       
   400 		int threadSampleAmount = 0;
       
   401 
       
   402 		for (Enumeration<GenericSample> e = samples.elements(); e.hasMoreElements();)
       
   403 		{
       
   404 			GppSample sample = (GppSample)e.nextElement();
       
   405 
       
   406 			String functionName = Messages.getString("AddressPlugin.2");  //$NON-NLS-1$
       
   407 
       
   408 			if (sample.currentFunctionSym != null)
       
   409 				functionName = sample.currentFunctionSym.functionName;
       
   410 			else if (sample.currentFunctionItt != null)
       
   411 				functionName = sample.currentFunctionItt.functionName;
       
   412 
       
   413 			if (sample.thread.threadId.intValue() == threadId)
       
   414 			{
       
   415 				Integer load = (Integer)functionLoad.get(functionName);
       
   416 				if (load != null)
       
   417 				{
       
   418 					functionLoad.remove(functionName);
       
   419 					functionLoad.put(functionName, new Integer(load.intValue()+1));
       
   420 				}
       
   421 				else
       
   422 				{
       
   423 					functionLoad.put(functionName, new Integer(1));
       
   424 				}
       
   425 				threadSampleAmount++;
       
   426 			}
       
   427 		}
       
   428 		float totalLoad = 0;
       
   429 		int functions = 0;
       
   430 //		int functionsShown = 10;
       
   431 		for (Enumeration<String> e = functionLoad.keys();e.hasMoreElements();)
       
   432 		{
       
   433 			String testFunction = e.nextElement();
       
   434 			float load = ((Integer)functionLoad.get(testFunction)).floatValue()*100/threadSampleAmount;
       
   435 			totalLoad += load;
       
   436 			functions++;
       
   437 		}
       
   438 
       
   439 		ArrayList<Object> sortedFunctions = new ArrayList<Object>();
       
   440 //		functionsShown = new Integer(functionsShownField.getText()).intValue();
       
   441 		while (functionLoad.size() != 0 && sortedFunctions.size() <= (functionsShown * 2) - 1)
       
   442 		{
       
   443 			String maxFunction = null;
       
   444 			int maxCount = 0;
       
   445 
       
   446 			for (Enumeration<String> e = functionLoad.keys(); e.hasMoreElements();)
       
   447 			{
       
   448 				String testFunction = e.nextElement();
       
   449 				int count = functionLoad.get(testFunction).intValue();
       
   450 				if (count > maxCount)
       
   451 				{
       
   452 					maxFunction = testFunction;
       
   453 					maxCount = count;
       
   454 				}
       
   455 			}
       
   456 			sortedFunctions.add(maxFunction);
       
   457 			sortedFunctions.add(new Integer(maxCount));
       
   458 			functionLoad.remove(maxFunction);
       
   459 		}
       
   460 
       
   461 		if (threadSampleAmount > 0)
       
   462 		{
       
   463 			String finalString = "\r\n" + Messages.getString("AddressPlugin.4")+threadName+"\r\n";   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
       
   464 
       
   465 			for (int i = 0; i < sortedFunctions.size(); )
       
   466 			{
       
   467 				String name = (String)sortedFunctions.get(i++);
       
   468 				//String percent = ((Integer)e.nextElement()).floatValue()*100/threadSampleAmount+"%";
       
   469 
       
   470 				float load = ((Integer)sortedFunctions.get(i++)).floatValue()*100/threadSampleAmount;
       
   471 				String percent = new Float(load/totalLoad*100).toString();
       
   472 
       
   473 				finalString += percent+"% "+name+"\r\n"; //$NON-NLS-1$ //$NON-NLS-2$ 
       
   474 			}
       
   475 
       
   476 			return finalString;
       
   477 		}
       
   478 		else return "\r\n"  + Messages.getString("AddressPlugin.8")+threadName+"\r\n";   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
       
   479 	}
       
   480 
       
   481 	public Action getIncludeAction()
       
   482 	{
       
   483 		return null;
       
   484 	}
       
   485 
       
   486 
       
   487 	public Action getExportAction() {
       
   488 		Action action = new Action(Messages.getString("AddressPlugin.10"), Action.AS_PUSH_BUTTON) {  //$NON-NLS-1$
       
   489 			public void run() {
       
   490 				ParsedTraceData ptd = TraceDataRepository.getInstance().getTrace(NpiInstanceRepository.getInstance().activeUid(), getTraceClass());
       
   491 				if (ptd != null) {
       
   492 					final GppTrace gppTraceTmp = (GppTrace)ptd.traceData;
       
   493 					final FileDialog dlg = new FileDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SAVE);
       
   494 					
       
   495 					new Thread()
       
   496 					{
       
   497 						public void run()
       
   498 						{
       
   499 							dlg.setFilterNames(new String[] {
       
   500 									Messages.getString("AddressPlugin.11") + " (*.csv)"  //$NON-NLS-1$ //$NON-NLS-2$
       
   501 							});
       
   502 							dlg.setFilterExtensions(new String[] {
       
   503 									"*.csv" //$NON-NLS-1$
       
   504 							});
       
   505 							dlg.setText(Messages.getString("AddressPlugin.13"));  //$NON-NLS-1$
       
   506 
       
   507 							String fileName = dlg.open();
       
   508 							if (fileName == null) {
       
   509 								return;
       
   510 							}
       
   511 							
       
   512 							File file = new File(fileName);
       
   513 						    GppTraceCsvPrinter csvPrinter = new GppTraceCsvPrinter(gppTraceTmp);
       
   514 						    String csvPrint = csvPrinter.getCsvPrint();
       
   515 						    if (csvPrint != null)
       
   516 						    {
       
   517 						    	try {
       
   518 							        PIUtilities.saveCsvPrint(file, csvPrint);
       
   519 						    	}
       
   520 								catch (Exception e) 
       
   521 								{
       
   522 								    e.printStackTrace();
       
   523 								}
       
   524 						    }
       
   525 						}
       
   526 					}.start();
       
   527 				}
       
   528 			}
       
   529 		};
       
   530 
       
   531 		return action;
       
   532 	}
       
   533 
       
   534 	public MenuManager getReportGeneratorManager()
       
   535 	{
       
   536 		MenuManager reportManager;
       
   537 		Action reportAction;
       
   538 		
       
   539 		reportAction = new Action(Messages.getString("AddressPlugin.6")) {  //$NON-NLS-1$
       
   540 			public void run() {
       
   541 				Display display = PIPageEditor.currentPageEditor().getEditorSite().getShell().getDisplay();
       
   542 				Shell shell = new Shell(display);
       
   543 				shell.setText(Messages.getString("AddressPlugin.15"));  //$NON-NLS-1$
       
   544 				shell.setLayout(new FillLayout());
       
   545 				Text number = new Text(shell, SWT.BORDER);
       
   546 				number.setLayoutData(new FillLayout());
       
   547 				final Text numberFinal = number;
       
   548 				number.addSelectionListener(new SelectionAdapter() {
       
   549 					public void widgetSelected(SelectionEvent e) {
       
   550 						functionCountString = numberFinal.getText();
       
   551 					}
       
   552 				});
       
   553 				shell.pack();
       
   554 				shell.open();
       
   555 				while (!shell.isDisposed()) {
       
   556 					if (!display.readAndDispatch()) {
       
   557 						display.sleep();
       
   558 					}
       
   559 				}
       
   560 				try {
       
   561 					functionsShown = Integer.parseInt(functionCountString);
       
   562 				} catch (NumberFormatException e1) {
       
   563 		        	GeneralMessages.showErrorMessage(Messages.getString("AddressPlugin.16"));  //$NON-NLS-1$
       
   564 				}
       
   565 			}
       
   566 		};
       
   567 		reportAction.setToolTipText(Messages.getString("AddressPlugin.17"));  //$NON-NLS-1$
       
   568 
       
   569 		// hook up to the PI toplevel menu
       
   570 		reportManager = new MenuManager(Messages.getString("AddressPlugin.3"));  //$NON-NLS-1$
       
   571 		reportManager.add(reportAction);
       
   572 		PIPageEditor.currentMenuManager().add(reportManager);
       
   573 
       
   574 		return reportManager;
       
   575 	}
       
   576 
       
   577 	public MenuManager getViewOptionManager()
       
   578 	{
       
   579 		Action action;
       
   580 		
       
   581 		MenuManager manager = new MenuManager(Messages.getString("AddressPlugin.5"));  //$NON-NLS-1$
       
   582 		
       
   583 		action = new Action(Messages.getString("AddressPlugin.7"), Action.AS_CHECK_BOX) {  //$NON-NLS-1$
       
   584 			public void run() {
       
   585 				if (this.isChecked())
       
   586 					receiveSelectionEvent("setBarOn"); //$NON-NLS-1$
       
   587 				else
       
   588 					receiveSelectionEvent("setBarOff"); //$NON-NLS-1$
       
   589 			}
       
   590 		};
       
   591 		
       
   592 		Boolean bar = SessionPreferences.getInstance().getBarMode();		// default value to session preference
       
   593 
       
   594 		Object obj;
       
   595 		obj = NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.bar"); //$NON-NLS-1$
       
   596 		if ((obj != null) && (obj instanceof Boolean))
       
   597 			// retrieve the current value
       
   598 			bar = (Boolean)obj;
       
   599 		else
       
   600 			// set the initial value
       
   601 			NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.bar", bar); //$NON-NLS-1$
       
   602 
       
   603 		action.setChecked(bar);
       
   604 		action.setToolTipText("Show graph as vertical bars"); //$NON-NLS-1$
       
   605 		manager.add(action);
       
   606 		
       
   607 //		manager.add(new Separator());
       
   608 		
       
   609 		Boolean fillAll = SessionPreferences.getInstance().getFillAllEnabled();		// default value to session preference
       
   610 		
       
   611 		// if there is a value associated with the current Analyser tab, then use it
       
   612 		obj = NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.address.fillAll"); //$NON-NLS-1$
       
   613 		if ((obj != null) && (obj instanceof Boolean))
       
   614 			// retrieve the current value
       
   615 			fillAll = (Boolean)obj;
       
   616 		else
       
   617 			// set the initial value
       
   618 			NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.address.fillAll", fillAll); //$NON-NLS-1$
       
   619 
       
   620 		action = new Action(Messages.getString("AddressPlugin.9"), Action.AS_CHECK_BOX) {  //$NON-NLS-1$
       
   621 			public void run() {
       
   622 				if (this.isChecked()) {
       
   623 					receiveSelectionEvent("fillAll"); //$NON-NLS-1$
       
   624 				} else {
       
   625 					receiveSelectionEvent("fillNone"); //$NON-NLS-1$
       
   626 				}
       
   627 			}
       
   628 		};
       
   629 		action.setChecked(fillAll);
       
   630 		action.setToolTipText(Messages.getString("AddressPlugin.22"));  //$NON-NLS-1$
       
   631 		manager.add(action);
       
   632 		
       
   633 //		manager.add(new Separator());
       
   634 //		
       
   635 //		action = new Action(Messages.getString("AddressPlugin.saveAddressThreadSamples"), Action.AS_PUSH_BUTTON) { //$NON-NLS-1$
       
   636 //			public void run() {
       
   637 //				new SaveSamplesWizard(Display.getCurrent());
       
   638 //			}
       
   639 //		};
       
   640 //		action.setToolTipText(Messages.getString("AddressPlugin.saveSamplesToolTip")); //$NON-NLS-1$
       
   641 //		manager.add(action);
       
   642 		
       
   643 		manager.add(new Separator());
       
   644 		
       
   645 		action = new Action(Messages.getString("AddressPlugin.12"), Action.AS_PUSH_BUTTON) {  //$NON-NLS-1$
       
   646 			public void run() {
       
   647 				new SetThresholdsDialog(Display.getCurrent());
       
   648 			}
       
   649 		};
       
   650 		action.setToolTipText(Messages.getString("AddressPlugin.24"));  //$NON-NLS-1$
       
   651 		manager.add(action);
       
   652 
       
   653 		return manager;
       
   654 	}
       
   655 
       
   656 	public Serializable getAdditionalData()
       
   657 	{
       
   658 		if (plugin == null)
       
   659 			return null;
       
   660 
       
   661 		GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   662 		
       
   663 		if (trace == null)
       
   664 			return null;
       
   665 
       
   666 		Vector<Object> wrapper = new Vector<Object>();
       
   667 		
       
   668 		Hashtable<Integer,java.awt.Color> threadColors = new Hashtable<Integer,java.awt.Color>();
       
   669 		Hashtable<String,java.awt.Color> binaryColors  = new Hashtable<String,java.awt.Color>();
       
   670 		Enumeration<ProfiledGeneric> e = trace.getSortedThreadsElements();
       
   671 		while (e.hasMoreElements())
       
   672 		{
       
   673 			ProfiledThread pt = (ProfiledThread)e.nextElement();
       
   674 			// backward compatibility with old Swing Color
       
   675 			java.awt.Color tmpAWTColor = new java.awt.Color(pt.getColor().getRed(),pt.getColor().getGreen(),pt.getColor().getBlue());
       
   676 			threadColors.put(new Integer(pt.getThreadId()), tmpAWTColor);
       
   677 		}
       
   678 		e = trace.getSortedBinariesElements();
       
   679 		while (e.hasMoreElements())
       
   680 		{
       
   681 			ProfiledBinary pb = (ProfiledBinary)e.nextElement();
       
   682 			// backward compatibility with old Swing Color
       
   683 			java.awt.Color tmpAWTColor = new java.awt.Color(pb.getColor().getRed(),pb.getColor().getGreen(),pb.getColor().getBlue());
       
   684 			binaryColors.put(pb.getNameString(), tmpAWTColor);
       
   685 		}
       
   686 
       
   687 		e = trace.getSortedFunctionsElements();
       
   688 		
       
   689 		Hashtable<String,java.awt.Color> functionColors  = new Hashtable<String,java.awt.Color>();
       
   690 
       
   691 		while (e.hasMoreElements())
       
   692 		{
       
   693 			ProfiledFunction pb = (ProfiledFunction)e.nextElement();
       
   694 			// backward compatibility with old Swing Color
       
   695 			java.awt.Color tmpAWTColor = new java.awt.Color(pb.getColor().getRed(),pb.getColor().getGreen(),pb.getColor().getBlue());
       
   696 			functionColors.put(pb.getNameString(), tmpAWTColor);
       
   697 		}
       
   698 		
       
   699 		wrapper.add(threadColors);
       
   700 		wrapper.add(binaryColors);
       
   701 		wrapper.add(functionColors);
       
   702 		return wrapper;
       
   703 	}
       
   704 
       
   705 	public void setAdditionalData(int graphIndex, Serializable data)
       
   706 	{
       
   707 		if (!(data instanceof Vector))
       
   708 			return;
       
   709 		
       
   710 		try {
       
   711 			final GppTrace trace = (GppTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.address"); //$NON-NLS-1$
       
   712 
       
   713 			Vector<Object> tmpData = (Vector<Object>)data;
       
   714 			Hashtable<Integer,java.awt.Color> threadColors = (Hashtable<Integer,java.awt.Color>)tmpData.elementAt(0);
       
   715 			Hashtable<String,java.awt.Color> binaryColors = (Hashtable<String,java.awt.Color>)tmpData.elementAt(1);
       
   716 			Hashtable<String,java.awt.Color> functionColors = (Hashtable<String,java.awt.Color>)tmpData.elementAt(2);
       
   717 
       
   718 			boolean changed;
       
   719 			Enumeration<ProfiledGeneric> e;
       
   720 			
       
   721 			changed = false;
       
   722 			e = trace.getSortedThreadsElements();
       
   723 			while (e.hasMoreElements())
       
   724 			{
       
   725 				ProfiledThread pt = (ProfiledThread)e.nextElement();
       
   726 				// backward compatibility with old Swing Color
       
   727 				java.awt.Color tmpAWTColor = threadColors.get(new Integer(pt.getThreadId()));
       
   728 				if (tmpAWTColor != null) {
       
   729 					Color color = ColorPalette.getColor(new RGB(tmpAWTColor.getRed(), tmpAWTColor.getGreen(), tmpAWTColor.getBlue()));
       
   730 					if (color != null) {
       
   731 						pt.setColor(color);
       
   732 						changed = true;
       
   733 					}
       
   734 				}
       
   735 			}
       
   736 			
       
   737 			final int uid = NpiInstanceRepository.getInstance().activeUid();
       
   738 
       
   739 			if (changed) {
       
   740 				// need to provide new colors for the thread load table
       
   741 				trace.getGppGraph(PIPageEditor.THREADS_PAGE, uid).getThreadTable().addColor(Defines.THREADS);
       
   742 			}
       
   743 
       
   744 			changed = false;
       
   745 			e = trace.getSortedBinariesElements();
       
   746 			while (e.hasMoreElements())
       
   747 			{
       
   748 				ProfiledBinary pb = (ProfiledBinary)e.nextElement();
       
   749 				// backward compatibility with old Swing Color
       
   750 				java.awt.Color tmpAWTColor = binaryColors.get(pb.getNameString());
       
   751 				if (tmpAWTColor != null) {
       
   752 					Color color = ColorPalette.getColor(new RGB(tmpAWTColor.getRed(), tmpAWTColor.getGreen(), tmpAWTColor.getBlue()));
       
   753 					if (color != null) {
       
   754 						pb.setColor(color);
       
   755 						changed = true;
       
   756 					}
       
   757 				}
       
   758 			}
       
   759 
       
   760 			if (changed) {
       
   761 				// need to provide new colors for the binary load table
       
   762 				trace.getGppGraph(PIPageEditor.BINARIES_PAGE, uid).getBinaryTable().addColor(Defines.BINARIES);
       
   763 			}
       
   764 			
       
   765 			changed = false;
       
   766 			e = trace.getSortedFunctionsElements();
       
   767 			while (e.hasMoreElements())
       
   768 			{
       
   769 				ProfiledFunction pb = (ProfiledFunction)e.nextElement();
       
   770 				// backward compatibility with old Swing Color
       
   771 				java.awt.Color tmpAWTColor = functionColors.get(pb.getNameString());
       
   772 				if (tmpAWTColor != null) {
       
   773 					Color color = ColorPalette.getColor(new RGB(tmpAWTColor.getRed(), tmpAWTColor.getGreen(), tmpAWTColor.getBlue()));
       
   774 					if (color != null) {
       
   775 						pb.setColor(color);
       
   776 						changed = true;
       
   777 					}
       
   778 				}
       
   779 			}
       
   780 
       
   781 			if (changed) {
       
   782 				// need to provide new colors for the binary load table
       
   783 				trace.getGppGraph(PIPageEditor.FUNCTIONS_PAGE, uid).getFunctionTable().addColor(Defines.FUNCTIONS);
       
   784 			}
       
   785 			
       
   786 		} catch (Exception e) {
       
   787 			System.out.println("Could not load additional address/thread data!"); //$NON-NLS-1$
       
   788 //			e.printStackTrace();
       
   789 		}
       
   790 	}
       
   791 
       
   792 	/**
       
   793 	 * This method is called upon plug-in activation
       
   794 	 */
       
   795 	public void start(BundleContext context) throws Exception {
       
   796 		super.start(context);
       
   797 	}
       
   798 
       
   799 	/**
       
   800 	 * This method is called when the plug-in is stopped
       
   801 	 */
       
   802 	public void stop(BundleContext context) throws Exception {
       
   803 		super.stop(context);
       
   804 		setPlugin(null);
       
   805 	}
       
   806 
       
   807 	/**
       
   808 	 * Returns the shared instance.
       
   809 	 */
       
   810 	public static AddressPlugin getDefault() {
       
   811 		return plugin;
       
   812 	}
       
   813 
       
   814 	/**
       
   815 	 * Returns an image descriptor for the image file at the given
       
   816 	 * plug-in relative path.
       
   817 	 *
       
   818 	 * @param path the path
       
   819 	 * @return the image descriptor
       
   820 	 */
       
   821 	public static ImageDescriptor getImageDescriptor(String path) {
       
   822 		return AbstractPiPlugin.imageDescriptorFromPlugin("com.nokia.carbide.cpp.pi.address", path); //$NON-NLS-1$
       
   823 	}
       
   824 
       
   825 	// number of graphs supplied by this plugin
       
   826 	public int getGraphCount() {
       
   827 		return GRAPH_COUNT;
       
   828 	}
       
   829 
       
   830 	// page number of each graph supplied by this plugin
       
   831 	public int getPageNumber(int graphIndex) {
       
   832 		if (graphIndex == 0)
       
   833 			return PIPageEditor.THREADS_PAGE;
       
   834 		else if (graphIndex == 1)
       
   835 			return PIPageEditor.BINARIES_PAGE;
       
   836 		else if (graphIndex == 2)
       
   837 			return PIPageEditor.FUNCTIONS_PAGE;
       
   838 
       
   839 		return PIPageEditor.NEXT_AVAILABLE_PAGE;
       
   840 	}
       
   841 
       
   842 	// return whether this plugin's editor pages have been created
       
   843 	public boolean arePagesCreated() {
       
   844 		return this.pagesCreated;
       
   845 	}
       
   846 	
       
   847 	// set whether this plugin's editor pages have been created
       
   848 	public void setPagesCreated(boolean pagesCreated) {
       
   849 		this.pagesCreated = pagesCreated;
       
   850 	}
       
   851 
       
   852 	// number of editor pages to create
       
   853 	public int getCreatePageCount() {
       
   854 		return GRAPH_COUNT;
       
   855 	}
       
   856 
       
   857 	// editor page index for each created editor page
       
   858 	public int getCreatePageIndex(int index) {
       
   859 		if (index == 0)
       
   860 			return PIPageEditor.THREADS_PAGE;
       
   861 		else if (index == 1)
       
   862 			return PIPageEditor.BINARIES_PAGE;
       
   863 		else if (index == 2)
       
   864 			return PIPageEditor.FUNCTIONS_PAGE;
       
   865 
       
   866 		return PIPageEditor.NEXT_AVAILABLE_PAGE;
       
   867 	}
       
   868 
       
   869 	// page index actually assigned to a created page
       
   870 	public void setPageIndex(int index, int pageIndex) {
       
   871 		// if we didn't get pages 0, 1, and 2, we're in trouble
       
   872 	}
       
   873 
       
   874 	// create the page(s)
       
   875 	public ProfileVisualiser createPage(int index) {
       
   876 		String pageName = null;
       
   877 		String pageHelp = null;
       
   878 		Composite parent = NpiInstanceRepository.getInstance().activeUidGetParentComposite();
       
   879 		
       
   880 		if (parent == null) {
       
   881 			// no parent composite is only for temp instance used by non-GUI importer
       
   882 			GeneralMessages.showErrorMessage("Address trace failed to create UI"); //$NON-NLS-1$
       
   883 			return null;
       
   884 		}
       
   885 
       
   886 		if (index == 0) {
       
   887 			pageName = "Threads"; //$NON-NLS-1$
       
   888 			pageHelp = "threadsPageContext"; //$NON-NLS-1$
       
   889 		} else if (index == 1) {
       
   890 			pageName = "Binaries"; //$NON-NLS-1$
       
   891 			pageHelp = "binariesPageContext"; //$NON-NLS-1$
       
   892 		} else if (index == 2) {
       
   893 			pageName = "Functions"; //$NON-NLS-1$
       
   894 			pageHelp = "functionsPageContext"; //$NON-NLS-1$
       
   895 		} else {
       
   896 			return null;
       
   897 		}
       
   898 
       
   899 		ProfileVisualiser pV = new ProfileVisualiser(ProfileVisualiser.TOP_AND_BOTTOM, parent, pageName);
       
   900 		int uid = NpiInstanceRepository.getInstance().activeUid();
       
   901 		AnalysisInfoHandler infoHandler = NpiInstanceRepository.getInstance().activeUidGetAnalysisInfoHandler();
       
   902 		pV.getParserRepository().setPIAnalysisInfoHandler(infoHandler);
       
   903 		PlatformUI.getWorkbench().getHelpSystem().setHelp(pV.getContentPane(), HELP_CONTEXT_ID + "." + pageHelp); //$NON-NLS-1$
       
   904 
       
   905 		return pV;
       
   906 	}
       
   907 
       
   908 	public void receiveEvent(String action, Event event) {
       
   909 		if (action.equals("scroll")) { //$NON-NLS-1$
       
   910 			if (   !(event.data instanceof String)
       
   911 				|| !((String)event.data).equals("FigureCanvas")) //$NON-NLS-1$
       
   912 				return;
       
   913 			
       
   914 			// the currently visible page has scrolled, so scroll the other pages
       
   915 			ArrayList<ProfileVisualiser> pages = NpiInstanceRepository.getInstance().activeUidGetProfilePages();
       
   916 			ProfileVisualiser pV;
       
   917 
       
   918 			int currentPV = PIPageEditor.currentPageIndex();
       
   919 			if (currentPV != PIPageEditor.THREADS_PAGE) {
       
   920 				pV = pages.get(PIPageEditor.THREADS_PAGE);
       
   921 				pV.getTopComposite().setScrolledOrigin(event.x, event.y);
       
   922 			}
       
   923 			if (currentPV != PIPageEditor.BINARIES_PAGE) {
       
   924 				pV = (ProfileVisualiser)pages.get(PIPageEditor.BINARIES_PAGE);
       
   925 				pV.getTopComposite().setScrolledOrigin(event.x, event.y);
       
   926 			}
       
   927 			if (currentPV != PIPageEditor.FUNCTIONS_PAGE) {
       
   928 				pV = (ProfileVisualiser)pages.get(PIPageEditor.FUNCTIONS_PAGE);
       
   929 				pV.getTopComposite().setScrolledOrigin(event.x, event.y);
       
   930 			}
       
   931 		} else if (action.equals("priority_init")) { //$NON-NLS-1$
       
   932 			// priority trace has been processed, so let the threads page know
       
   933 			Hashtable<Integer,String> priStringById = (Hashtable<Integer,String>)event.data;
       
   934 			
       
   935 			if (getTrace() == null)
       
   936 				return;
       
   937 
       
   938 			GppTraceGraph addressGraph = ((GppTraceGraph) getTrace().getTraceGraph(PIPageEditor.THREADS_PAGE));
       
   939 
       
   940 			if (addressGraph != null) {
       
   941 				addressGraph.updateThreadTablePriorities(priStringById);
       
   942 			}
       
   943 		}
       
   944 	}
       
   945 
       
   946 	/* (non-Javadoc)
       
   947 	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getGraphTitle(int)
       
   948 	 */
       
   949 	public String getGraphTitle(int graphIndex) {
       
   950 		return null;
       
   951 	}
       
   952 //	
       
   953 //	static public void putAddrThreadPeriod(long addrThreadPeriod) {
       
   954 //		uidToAddrThreadPeriod.put(NpiInstanceRepository.getInstance().activeUid(), addrThreadPeriod);
       
   955 //	}
       
   956 //	
       
   957 //	static public long getAddrThreadPeriod() {
       
   958 //		return uidToAddrThreadPeriod.get(NpiInstanceRepository.getInstance().activeUid());
       
   959 //	}
       
   960 }