sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.graphicsmemory/src/com/nokia/carbide/cpp/pi/graphicsmemory/GraphicsMemoryPlugin.java
changeset 12 ae255c9aa552
equal deleted inserted replaced
11:5b9d4d8641ce 12:ae255c9aa552
       
     1 /*
       
     2  * Copyright (c) 2010 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.graphicsmemory;
       
    19 
       
    20 import java.io.File;
       
    21 import java.io.IOException;
       
    22 import java.util.ArrayList;
       
    23 import java.util.Hashtable;
       
    24 
       
    25 import org.eclipse.jface.action.Action;
       
    26 import org.eclipse.jface.action.MenuManager;
       
    27 import org.eclipse.jface.action.Separator;
       
    28 import org.eclipse.jface.resource.ImageDescriptor;
       
    29 import org.eclipse.swt.widgets.Display;
       
    30 import org.eclipse.swt.widgets.Event;
       
    31 import org.osgi.framework.BundleContext;
       
    32 
       
    33 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository;
       
    34 import com.nokia.carbide.cpp.internal.pi.analyser.ProfileReader;
       
    35 import com.nokia.carbide.cpp.internal.pi.analyser.ProfileVisualiser;
       
    36 import com.nokia.carbide.cpp.internal.pi.model.GenericTrace;
       
    37 import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData;
       
    38 import com.nokia.carbide.cpp.internal.pi.plugin.model.AbstractPiPlugin;
       
    39 import com.nokia.carbide.cpp.internal.pi.plugin.model.IClassReplacer;
       
    40 import com.nokia.carbide.cpp.internal.pi.plugin.model.IEventListener;
       
    41 import com.nokia.carbide.cpp.internal.pi.plugin.model.IReportable;
       
    42 import com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace;
       
    43 import com.nokia.carbide.cpp.internal.pi.plugin.model.IViewMenu;
       
    44 import com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable;
       
    45 import com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph;
       
    46 import com.nokia.carbide.cpp.internal.pi.visual.GraphDrawRequest;
       
    47 import com.nokia.carbide.cpp.internal.pi.visual.PIEvent;
       
    48 import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
       
    49 
       
    50 /**
       
    51  * The main plugin class to be used in the desktop.
       
    52  */
       
    53 public class GraphicsMemoryPlugin extends AbstractPiPlugin implements
       
    54 		IViewMenu, ITrace, IClassReplacer, IVisualizable, IEventListener,
       
    55 		IReportable {
       
    56 	private static final String HELP_CONTEXT_ID = PIPageEditor.PI_ID
       
    57 			+ ".graphicsmemory"; //$NON-NLS-1$
       
    58 	public static final String HELP_CONTEXT_ID_MAIN_PAGE = HELP_CONTEXT_ID
       
    59 			+ ".graphicsMemoryPageContext"; //$NON-NLS-1$
       
    60 
       
    61 	public static final String PLUGIN_ID = "com.nokia.carbide.cpp.pi.graphicsmemory"; //$NON-NLS-1$
       
    62 
       
    63 	// There will be 1 graph for editor page 0
       
    64 	// This code may assume that page 0 has the threads graph
       
    65 	private final static int GRAPH_COUNT = 3;
       
    66 
       
    67 	// The shared instance.
       
    68 	private static GraphicsMemoryPlugin plugin;
       
    69 
       
    70 	private static void setPlugin(GraphicsMemoryPlugin newPlugin) {
       
    71 		plugin = newPlugin;
       
    72 	}
       
    73 
       
    74 	/**
       
    75 	 * The constructor.
       
    76 	 */
       
    77 	public GraphicsMemoryPlugin() {
       
    78 		super();
       
    79 		setPlugin(this);
       
    80 	}
       
    81 
       
    82 	/**
       
    83 	 * This method is called upon plug-in activation
       
    84 	 */
       
    85 	public void start(BundleContext context) throws Exception {
       
    86 		super.start(context);
       
    87 	}
       
    88 
       
    89 	/**
       
    90 	 * This method is called when the plug-in is stopped
       
    91 	 */
       
    92 	public void stop(BundleContext context) throws Exception {
       
    93 		super.stop(context);
       
    94 		setPlugin(null);
       
    95 	}
       
    96 
       
    97 	/**
       
    98 	 * Returns the shared instance.
       
    99 	 */
       
   100 	public static GraphicsMemoryPlugin getDefault() {
       
   101 		return plugin;
       
   102 	}
       
   103 
       
   104 	/**
       
   105 	 * Update menu items
       
   106 	 */
       
   107 	public void updateMenuItems() {
       
   108 		int uid = NpiInstanceRepository.getInstance().activeUid();
       
   109 		ProfileReader.getInstance().setTraceMenus(
       
   110 				NpiInstanceRepository.getInstance().getPlugins(uid), uid);
       
   111 	}
       
   112 
       
   113 	/**
       
   114 	 * Returns an image descriptor for the image file at the given plug-in
       
   115 	 * relative path.
       
   116 	 * 
       
   117 	 * @param path
       
   118 	 *            the path
       
   119 	 * @return the image descriptor
       
   120 	 */
       
   121 	public static ImageDescriptor getImageDescriptor(String path) {
       
   122 		return AbstractPiPlugin.imageDescriptorFromPlugin(
       
   123 				GraphicsMemoryPlugin.PLUGIN_ID, path); //$NON-NLS-1$
       
   124 	}
       
   125 
       
   126 	@SuppressWarnings("unchecked")
       
   127 	public Class getTraceClass() {
       
   128 		return GraphicsMemoryTrace.class;
       
   129 	}
       
   130 
       
   131 	@SuppressWarnings("unchecked")
       
   132 	public Class getReplacedClass(String className) {
       
   133 		if (className.indexOf(GraphicsMemoryPlugin.PLUGIN_ID
       
   134 				+ ".GraphicsMemoryTrace") != -1)//$NON-NLS-1$
       
   135 		{
       
   136 			return GraphicsMemoryTrace.class;
       
   137 		} else if (className.indexOf(GraphicsMemoryPlugin.PLUGIN_ID
       
   138 				+ ".GraphicsMemorySample") != -1)//$NON-NLS-1$
       
   139 		{
       
   140 			return GraphicsMemorySample.class;
       
   141 		} else if (className
       
   142 				.indexOf("[L" + GraphicsMemoryPlugin.PLUGIN_ID + ".GraphicsMemoryProcess") != -1)//$NON-NLS-1$ //$NON-NLS-2$
       
   143 		{
       
   144 			return GraphicsMemoryProcess[].class;
       
   145 		} else if (className.indexOf(GraphicsMemoryPlugin.PLUGIN_ID
       
   146 				+ ".GraphicsMemoryProcess") != -1)//$NON-NLS-1$
       
   147 		{
       
   148 			return GraphicsMemoryProcess.class;
       
   149 		} else
       
   150 			return null;
       
   151 	}
       
   152 
       
   153 	public void initialiseTrace(GenericTrace trace) {
       
   154 		if (!(trace instanceof GraphicsMemoryTrace))
       
   155 			return;
       
   156 
       
   157 		GraphicsMemoryTrace memTrace = (GraphicsMemoryTrace) trace;
       
   158 
       
   159 		NpiInstanceRepository.getInstance().activeUidAddTrace(
       
   160 				GraphicsMemoryPlugin.PLUGIN_ID, trace); //$NON-NLS-1$
       
   161 
       
   162 		memTrace.gatherDrawData();
       
   163 
       
   164 		System.out.println(Messages
       
   165 				.getString("GraphicsMemoryPlugin.traceProcessed")); //$NON-NLS-1$
       
   166 	}
       
   167 
       
   168 	public String getTraceName() {
       
   169 		return "GraphicsMemory"; //$NON-NLS-1$
       
   170 	}
       
   171 
       
   172 	/*
       
   173 	 * (non-Javadoc)
       
   174 	 * 
       
   175 	 * @see
       
   176 	 * com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceTitle()
       
   177 	 */
       
   178 	public String getTraceTitle() {
       
   179 		return Messages.getString("GraphicsMemoryPlugin.1"); //$NON-NLS-1$
       
   180 	}
       
   181 
       
   182 	public int getTraceId() {
       
   183 		return 14;
       
   184 	}
       
   185 
       
   186 	/*
       
   187 	 * (non-Javadoc)
       
   188 	 * 
       
   189 	 * @see
       
   190 	 * com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#parseTraceFiles
       
   191 	 * (java.io.File[])
       
   192 	 */
       
   193 	public ParsedTraceData parseTraceFiles(File[] files) throws Exception {
       
   194 		throw new UnsupportedOperationException();
       
   195 	}
       
   196 
       
   197 	public ParsedTraceData parseTraceFile(File file) throws Exception {
       
   198 		ParsedTraceData traceData = null;
       
   199 		try {
       
   200 			GraphicsMemoryTraceParser memParser = new GraphicsMemoryTraceParser();
       
   201 			traceData = memParser.parse(file);
       
   202 			return traceData;
       
   203 		} catch (IOException e) {
       
   204 			e.printStackTrace();
       
   205 			throw e;
       
   206 		}
       
   207 	}
       
   208 
       
   209 	public MenuManager getViewOptionManager() {
       
   210 		if (NpiInstanceRepository.getInstance().activeUidGetTrace(
       
   211 				GraphicsMemoryPlugin.PLUGIN_ID) == null) //$NON-NLS-1$
       
   212 			return null; // no trace, so no MenuManager
       
   213 
       
   214 		boolean showPrivate = true;
       
   215 		boolean showShared = true;
       
   216 
       
   217 		// if there is a showPrivate value associated with the current Analyser
       
   218 		// tab, then use it
       
   219 		Object obj;
       
   220 		obj = NpiInstanceRepository.getInstance().activeUidGetPersistState(
       
   221 				GraphicsMemoryPlugin.PLUGIN_ID + ".showPrivate"); //$NON-NLS-1$
       
   222 		if ((obj != null) && (obj instanceof Boolean))
       
   223 			// retrieve the current value
       
   224 			showPrivate = (Boolean) obj;
       
   225 		else
       
   226 			// set the initial value
       
   227 			NpiInstanceRepository
       
   228 					.getInstance()
       
   229 					.activeUidSetPersistState(
       
   230 							GraphicsMemoryPlugin.PLUGIN_ID + ".showPrivate", showPrivate); //$NON-NLS-1$
       
   231 
       
   232 		// if there is a showShared value associated with the current
       
   233 		// Analyser tab, then use it
       
   234 		obj = NpiInstanceRepository.getInstance().activeUidGetPersistState(
       
   235 				GraphicsMemoryPlugin.PLUGIN_ID + ".showShared"); //$NON-NLS-1$
       
   236 		if ((obj != null) && (obj instanceof Boolean))
       
   237 			// retrieve the current value
       
   238 			showShared = (Boolean) obj;
       
   239 		else
       
   240 			// set the initial value
       
   241 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   242 					GraphicsMemoryPlugin.PLUGIN_ID + ".showShared", showShared); //$NON-NLS-1$
       
   243 
       
   244 		Action action;
       
   245 
       
   246 		MenuManager manager = new MenuManager(Messages
       
   247 				.getString("GraphicsMemoryPlugin.graphicsMemoryGraph")); //$NON-NLS-1$
       
   248 
       
   249 		action = new Action(
       
   250 				Messages.getString("GraphicsMemoryPlugin.memoryStats"), Action.AS_PUSH_BUTTON) { //$NON-NLS-1$
       
   251 			public void run() {
       
   252 				new GraphicsMemoryStatisticsDialog(Display.getCurrent());
       
   253 			}
       
   254 		};
       
   255 
       
   256 		action.setToolTipText(Messages
       
   257 				.getString("GraphicsMemoryPlugin.memoryStatsTooltip")); //$NON-NLS-1$
       
   258 		manager.add(action);
       
   259 
       
   260 		manager.add(new Separator());
       
   261 
       
   262 		action = new Action(
       
   263 				Messages.getString("GraphicsMemoryPlugin.showPrivate"), Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
       
   264 			public void run() {
       
   265 				if (this.isChecked())
       
   266 					receiveSelectionEvent("private_on"); //$NON-NLS-1$
       
   267 			}
       
   268 		};
       
   269 		action.setChecked(showPrivate && !showShared);
       
   270 		action.setToolTipText(Messages
       
   271 				.getString("GraphicsMemoryPlugin.showPrivateTooltip")); //$NON-NLS-1$
       
   272 		manager.add(action);
       
   273 
       
   274 		action = new Action(
       
   275 				Messages.getString("GraphicsMemoryPlugin.showShared"), Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
       
   276 			public void run() {
       
   277 				if (this.isChecked())
       
   278 					receiveSelectionEvent("shared_on"); //$NON-NLS-1$
       
   279 			}
       
   280 		};
       
   281 		action.setChecked(showShared && !showPrivate);
       
   282 		action.setToolTipText(Messages
       
   283 				.getString("GraphicsMemoryPlugin.showSharedTooltip")); //$NON-NLS-1$
       
   284 		manager.add(action);
       
   285 
       
   286 		action = new Action(
       
   287 				Messages.getString("GraphicsMemoryPlugin.showAll"), Action.AS_RADIO_BUTTON) { //$NON-NLS-1$
       
   288 			public void run() {
       
   289 				if (this.isChecked())
       
   290 					receiveSelectionEvent("private_shared_on"); //$NON-NLS-1$
       
   291 			}
       
   292 		};
       
   293 		action.setChecked(showPrivate && showShared);
       
   294 		action.setToolTipText(Messages
       
   295 				.getString("GraphicsMemoryPlugin.showAllTooltip")); //$NON-NLS-1$
       
   296 		manager.add(action);
       
   297 
       
   298 		manager.add(new Separator());
       
   299 
       
   300 		boolean rescale = false;
       
   301 
       
   302 		// if there is a rescale value associated with the current Analyser tab,
       
   303 		// then use it
       
   304 		obj = NpiInstanceRepository.getInstance().activeUidGetPersistState(
       
   305 				GraphicsMemoryPlugin.PLUGIN_ID + ".rescale"); //$NON-NLS-1$
       
   306 		if ((obj != null) && (obj instanceof Boolean))
       
   307 			// retrieve the current value
       
   308 			rescale = (Boolean) obj;
       
   309 		else
       
   310 			// set the initial value
       
   311 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   312 					GraphicsMemoryPlugin.PLUGIN_ID + ".rescale", rescale); //$NON-NLS-1$
       
   313 
       
   314 		action = new Action(
       
   315 				Messages.getString("GraphicsMemoryPlugin.dynamicRescale"), Action.AS_CHECK_BOX) { //$NON-NLS-1$
       
   316 			public void run() {
       
   317 				if (this.isChecked())
       
   318 					receiveSelectionEvent("rescale_on"); //$NON-NLS-1$
       
   319 				else
       
   320 					receiveSelectionEvent("rescale_off"); //$NON-NLS-1$
       
   321 			}
       
   322 		};
       
   323 		action.setChecked(rescale);
       
   324 		action.setToolTipText(Messages
       
   325 				.getString("GraphicsMemoryPlugin.dynamicRescaleTooltip")); //$NON-NLS-1$
       
   326 		manager.add(action);
       
   327 
       
   328 		boolean showMemoryUsageLine = true;
       
   329 		// if there is a show memory usage value associated with the current
       
   330 		// Analyser tab, then use it
       
   331 		obj = NpiInstanceRepository.getInstance().activeUidGetPersistState(
       
   332 				GraphicsMemoryPlugin.PLUGIN_ID + ".showMemoryUsage"); //$NON-NLS-1$
       
   333 		if ((obj != null) && (obj instanceof Boolean))
       
   334 			// retrieve the current value
       
   335 			showMemoryUsageLine = (Boolean) obj;
       
   336 		else
       
   337 			// set the initial value
       
   338 			NpiInstanceRepository
       
   339 					.getInstance()
       
   340 					.activeUidSetPersistState(
       
   341 							GraphicsMemoryPlugin.PLUGIN_ID + ".showMemoryUsage", showMemoryUsageLine); //$NON-NLS-1$
       
   342 
       
   343 		action = new Action(
       
   344 				Messages
       
   345 						.getString("GraphicsMemoryTraceGraph.showTotalMemoryUsage"), Action.AS_CHECK_BOX) { //$NON-NLS-1$
       
   346 			public void run() {
       
   347 				if (this.isChecked())
       
   348 					receiveSelectionEvent("memory_usage_line_on"); //$NON-NLS-1$
       
   349 				else
       
   350 					receiveSelectionEvent("memory_usage_line_off"); //$NON-NLS-1$
       
   351 			}
       
   352 		};
       
   353 		action.setChecked(showMemoryUsageLine);
       
   354 		action.setToolTipText(Messages
       
   355 				.getString("GraphicsMemoryPlugin.showTotalMemoryUsageToolTip")); //$NON-NLS-1$
       
   356 		manager.add(action);
       
   357 
       
   358 		return manager;
       
   359 	}
       
   360 
       
   361 	public void receiveEvent(String actionString, Event event) {
       
   362 		GraphicsMemoryTrace trace = (GraphicsMemoryTrace) NpiInstanceRepository
       
   363 				.getInstance()
       
   364 				.activeUidGetTrace(GraphicsMemoryPlugin.PLUGIN_ID); //$NON-NLS-1$
       
   365 
       
   366 		if (trace == null)
       
   367 			return;
       
   368 
       
   369 		if (actionString.equals("private_on") //$NON-NLS-1$
       
   370 				|| actionString.equals("shared_on") //$NON-NLS-1$
       
   371 				|| actionString.equals("private_shared_on") //$NON-NLS-1$
       
   372 				|| actionString.equals("rescale_on") //$NON-NLS-1$
       
   373 				|| actionString.equals("rescale_off")) //$NON-NLS-1$
       
   374 		{
       
   375 			((GraphicsMemoryTraceGraph) trace
       
   376 					.getTraceGraph(PIPageEditor.THREADS_PAGE))
       
   377 					.action(actionString);
       
   378 			((GraphicsMemoryTraceGraph) trace
       
   379 					.getTraceGraph(PIPageEditor.BINARIES_PAGE))
       
   380 					.action(actionString);
       
   381 			((GraphicsMemoryTraceGraph) trace
       
   382 					.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE))
       
   383 					.action(actionString);
       
   384 		} else if (actionString.equals("scroll")) //$NON-NLS-1$
       
   385 		{
       
   386 			PIEvent be = new PIEvent(event, PIEvent.SCROLLED);
       
   387 
       
   388 			((GraphicsMemoryTraceGraph) trace
       
   389 					.getTraceGraph(PIPageEditor.THREADS_PAGE))
       
   390 					.piEventReceived(be);
       
   391 			((GraphicsMemoryTraceGraph) trace
       
   392 					.getTraceGraph(PIPageEditor.BINARIES_PAGE))
       
   393 					.piEventReceived(be);
       
   394 			((GraphicsMemoryTraceGraph) trace
       
   395 					.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE))
       
   396 					.piEventReceived(be);
       
   397 		}
       
   398 	}
       
   399 
       
   400 	public void receiveSelectionEvent(String actionString) {
       
   401 		if (actionString == null)
       
   402 			return;
       
   403 
       
   404 		if (actionString.equals("private_on")) { //$NON-NLS-1$
       
   405 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   406 					GraphicsMemoryPlugin.PLUGIN_ID + ".showPrivate", true); //$NON-NLS-1$
       
   407 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   408 					GraphicsMemoryPlugin.PLUGIN_ID + ".showShared", false); //$NON-NLS-1$
       
   409 		} else if (actionString.equals("shared_on")) { //$NON-NLS-1$
       
   410 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   411 					GraphicsMemoryPlugin.PLUGIN_ID + ".showPrivate", false); //$NON-NLS-1$
       
   412 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   413 					GraphicsMemoryPlugin.PLUGIN_ID + ".showShared", true); //$NON-NLS-1$
       
   414 		} else if (actionString.equals("private_shared_on")) { //$NON-NLS-1$
       
   415 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   416 					GraphicsMemoryPlugin.PLUGIN_ID + ".showPrivate", true); //$NON-NLS-1$
       
   417 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   418 					GraphicsMemoryPlugin.PLUGIN_ID + ".showShared", true); //$NON-NLS-1$
       
   419 		} else if (actionString.equals("rescale_on")) { //$NON-NLS-1$
       
   420 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   421 					GraphicsMemoryPlugin.PLUGIN_ID + ".rescale", true); //$NON-NLS-1$
       
   422 		} else if (actionString.equals("rescale_off")) { //$NON-NLS-1$
       
   423 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   424 					GraphicsMemoryPlugin.PLUGIN_ID + ".rescale", false); //$NON-NLS-1$
       
   425 		} else if (actionString.equals("memory_usage_line_on")) { //$NON-NLS-1$
       
   426 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   427 					GraphicsMemoryPlugin.PLUGIN_ID + ".showMemoryUsage", true); //$NON-NLS-1$
       
   428 		} else if (actionString.equals("memory_usage_line_off")) { //$NON-NLS-1$
       
   429 			NpiInstanceRepository.getInstance().activeUidSetPersistState(
       
   430 					GraphicsMemoryPlugin.PLUGIN_ID + ".showMemoryUsage", false); //$NON-NLS-1$
       
   431 		} else {
       
   432 			return;
       
   433 		}
       
   434 
       
   435 		((GraphicsMemoryTraceGraph) this
       
   436 				.getTraceGraph(PIPageEditor.THREADS_PAGE)).action(actionString);
       
   437 		((GraphicsMemoryTraceGraph) this
       
   438 				.getTraceGraph(PIPageEditor.BINARIES_PAGE))
       
   439 				.action(actionString);
       
   440 		((GraphicsMemoryTraceGraph) this
       
   441 				.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE))
       
   442 				.action(actionString);
       
   443 	}
       
   444 
       
   445 	public GenericTraceGraph getTraceGraph(int graphIndex) {
       
   446 		GraphicsMemoryTrace trace = (GraphicsMemoryTrace) NpiInstanceRepository
       
   447 				.getInstance()
       
   448 				.activeUidGetTrace(GraphicsMemoryPlugin.PLUGIN_ID); //$NON-NLS-1$
       
   449 
       
   450 		if (trace != null)
       
   451 			return trace.getTraceGraph(graphIndex);
       
   452 		else
       
   453 			return null;
       
   454 	}
       
   455 
       
   456 	public Integer getLastSample(int graphIndex) {
       
   457 		GraphicsMemoryTrace trace = (GraphicsMemoryTrace) NpiInstanceRepository
       
   458 				.getInstance()
       
   459 				.activeUidGetTrace(GraphicsMemoryPlugin.PLUGIN_ID); //$NON-NLS-1$
       
   460 
       
   461 		if (trace != null)
       
   462 			return Integer.valueOf(trace.getLastSampleNumber());
       
   463 		else
       
   464 			return null;
       
   465 	}
       
   466 
       
   467 	public Hashtable<Integer, Object> getSummaryTable(double start, double end) {
       
   468 		return null;
       
   469 	}
       
   470 
       
   471 	public String getGeneralInfo() {
       
   472 		return null;
       
   473 	}
       
   474 
       
   475 	public ArrayList<String> getColumnNames() {
       
   476 		ArrayList<String> names = new ArrayList<String>();
       
   477 		names.add(Messages.getString("GraphicsMemoryPlugin.namesProcess")); //$NON-NLS-1$
       
   478 		names.add(Messages.getString("GraphicsMemoryPlugin.namesAvgPrivate")); //$NON-NLS-1$
       
   479 		names.add(Messages.getString("GraphicsMemoryPlugin.namesAvgShared")); //$NON-NLS-1$
       
   480 		names.add(Messages.getString("GraphicsMemoryPlugin.namesTotal")); //$NON-NLS-1$
       
   481 		return names;
       
   482 	}
       
   483 
       
   484 	public ArrayList<Boolean> getColumnSortTypes() {
       
   485 		ArrayList<Boolean> sortTypes = new ArrayList<Boolean>();
       
   486 		sortTypes.add(SORT_BY_NAME);
       
   487 		sortTypes.add(SORT_BY_NUMBER);
       
   488 		sortTypes.add(SORT_BY_NUMBER);
       
   489 		sortTypes.add(SORT_BY_NUMBER);
       
   490 		return sortTypes;
       
   491 	}
       
   492 
       
   493 	public String getActiveInfo(Object arg0, double startTime, double endTime) {
       
   494 		return null;
       
   495 	}
       
   496 
       
   497 	public MenuManager getReportGeneratorManager() {
       
   498 		return null;
       
   499 	}
       
   500 
       
   501 	public GraphDrawRequest getDrawRequest(int graphIndex) {
       
   502 		return null;
       
   503 	}
       
   504 
       
   505 	public int getGraphCount() {
       
   506 		return GRAPH_COUNT;
       
   507 	}
       
   508 
       
   509 	public int getPageNumber(int graphIndex) {
       
   510 		// Assumes page 0 has the threads graph, 1 has the binaries, and 2 has
       
   511 		// the functions
       
   512 		if (graphIndex == 0)
       
   513 			return PIPageEditor.THREADS_PAGE;
       
   514 		else if (graphIndex == 1)
       
   515 			return PIPageEditor.BINARIES_PAGE;
       
   516 		else if (graphIndex == 2)
       
   517 			return PIPageEditor.FUNCTIONS_PAGE;
       
   518 
       
   519 		return PIPageEditor.NEXT_AVAILABLE_PAGE;
       
   520 	}
       
   521 
       
   522 	// return whether this plugin's editor pages have been created
       
   523 	public boolean arePagesCreated() {
       
   524 		return false;
       
   525 	}
       
   526 
       
   527 	public void setPagesCreated(boolean pagesCreated) {
       
   528 		return;
       
   529 	}
       
   530 
       
   531 	public int getCreatePageCount() {
       
   532 		return 0;
       
   533 	}
       
   534 
       
   535 	public int getCreatePageIndex(int index) {
       
   536 		return 0;
       
   537 	}
       
   538 
       
   539 	public ProfileVisualiser createPage(int index) {
       
   540 		return null;
       
   541 	}
       
   542 
       
   543 	public void setPageIndex(int index, int pageIndex) {
       
   544 		return;
       
   545 	}
       
   546 	
       
   547 	/*
       
   548 	 * (non-Javadoc)
       
   549 	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#isMandatory()
       
   550 	 */
       
   551 	public boolean isMandatory() {
       
   552 		return false;
       
   553 	}
       
   554 	
       
   555 	/*
       
   556 	 * (non-Javadoc)
       
   557 	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceDescription()
       
   558 	 */
       
   559 	public String getTraceDescription() {
       
   560 		return getTraceTitle();
       
   561 	}
       
   562 }