sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.ipc/src/com/nokia/carbide/cpp/pi/ipc/IpcPlugin.java
author Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
Wed, 23 Jun 2010 15:05:09 +0300
changeset 12 ae255c9aa552
parent 5 844b047e260d
permissions -rw-r--r--
Performance Investigator Carbide extension 2.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     1
package com.nokia.carbide.cpp.pi.ipc;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     2
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     3
import java.io.File;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     4
import java.io.IOException;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     5
import java.net.URL;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     6
import java.util.HashMap;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     7
import java.util.Map;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     8
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
     9
import org.eclipse.core.runtime.FileLocator;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    10
import org.eclipse.core.runtime.IPath;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    11
import org.eclipse.core.runtime.Path;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    12
import org.eclipse.swt.widgets.Event;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    13
import org.osgi.framework.Bundle;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    14
import org.osgi.framework.BundleContext;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    15
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    16
import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    17
import com.nokia.carbide.cpp.internal.pi.analyser.ProfileVisualiser;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    18
import com.nokia.carbide.cpp.internal.pi.model.GenericTrace;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    19
import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    20
import com.nokia.carbide.cpp.internal.pi.plugin.model.AbstractPiPlugin;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    21
import com.nokia.carbide.cpp.internal.pi.plugin.model.IClassReplacer;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    22
import com.nokia.carbide.cpp.internal.pi.plugin.model.IEventListener;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    23
import com.nokia.carbide.cpp.internal.pi.plugin.model.IFinalizeTrace;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    24
import com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    25
import com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    26
import com.nokia.carbide.cpp.internal.pi.visual.GraphDrawRequest;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    27
import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    28
import com.nokia.carbide.cpp.pi.internal.ipc.IpcSample;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    29
import com.nokia.carbide.cpp.pi.internal.ipc.IpcTrace;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    30
import com.nokia.carbide.cpp.pi.internal.ipc.IpcTraceParser;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    31
import com.nokia.carbide.cpp.pi.peccommon.PecCommonGuiManager;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    32
import com.nokia.carbide.cpp.pi.visual.IGenericTraceGraph;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    33
/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    34
 * The activator class controls the plug-in life cycle
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    35
 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    36
public class IpcPlugin extends AbstractPiPlugin implements ITrace, IEventListener, IVisualizable, IFinalizeTrace, IClassReplacer {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    37
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    38
	/** number of graphs created (one on each page)*/
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    39
	public static final int GRAPH_COUNT = 3;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    40
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    41
	/** The plug-in ID */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    42
	public static final String PLUGIN_ID = "com.nokia.carbide.cpp.pi.ipc"; //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    43
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    44
	private static final String HELP_CONTEXT_ID = PIPageEditor.PI_ID + ".ipc";  //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    45
	/** context help id of the main page */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    46
	public static final String HELP_CONTEXT_ID_MAIN_PAGE = HELP_CONTEXT_ID + ".ipcPageContext";  //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    47
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    48
	/** the trace id for PEC traces */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    49
	private static final int PEC_TRACE_ID = 12;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    50
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    51
	/** Persistable preference for the performance counter trace draw mode (show single graph or all graphs)  */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    52
	public static final String PECTRACE_DRAWMODE = "com.nokia.carbide.cpp.pi.ipc.drawmode";//$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    53
	/** draw mode for showing all graphs */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    54
	public static final String PECTRACE_DRAWMODE_SHOW_ALL = "ShowAll";//$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    55
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    56
	// The shared instance
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    57
	private static IpcPlugin plugin;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    58
	
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
    59
	private static final Map<Integer, PecCommonGuiManager> GUI_MANAGER_MAP = new HashMap<Integer, PecCommonGuiManager>();
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    60
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    61
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    62
	 * The constructor
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    63
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    64
	public IpcPlugin() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    65
		super();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    66
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    67
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    68
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    69
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    70
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    71
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    72
	@Override
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    73
	public void start(BundleContext context) throws Exception {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    74
		super.start(context);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    75
		plugin = this;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    76
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    77
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    78
	/*
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    79
	 * (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    80
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    81
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    82
	@Override
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    83
	public void stop(BundleContext context) throws Exception {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    84
		plugin = null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    85
		super.stop(context);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    86
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    87
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    88
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    89
	 * Returns the shared instance
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    90
	 *
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    91
	 * @return the shared instance
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    92
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    93
	public static IpcPlugin getDefault() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    94
		return plugin;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    95
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    96
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    97
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    98
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceClass()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
    99
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   100
	public Class getTraceClass() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   101
		return IpcTrace.class;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   102
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   103
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   104
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   105
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#initialiseTrace(com.nokia.carbide.cpp.internal.pi.model.GenericTrace)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   106
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   107
	public void initialiseTrace(GenericTrace trace) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   108
		if (!(trace instanceof IpcTrace)){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   109
			throw new IllegalArgumentException();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   110
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   111
			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   112
		IpcTrace parsedTrace = (IpcTrace)trace;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   113
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   114
		int samplingInterval = 1; //in milliseconds
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   115
		if (parsedTrace.samples.size() > 2) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   116
			samplingInterval = (int) ((parsedTrace.samples.get(1)).sampleSynchTime - (parsedTrace.samples.get(0)).sampleSynchTime); 
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   117
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   118
		parsedTrace.setSamplingInterval(samplingInterval);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   119
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   120
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   121
		NpiInstanceRepository.getInstance().activeUidAddTrace(PLUGIN_ID, trace);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   122
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   123
		//create the GUI class which manages the graphs
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   124
		int uid = NpiInstanceRepository.getInstance().activeUid();
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   125
		GUI_MANAGER_MAP.put(uid, new PecCommonGuiManager(uid, parsedTrace, IpcPlugin.GRAPH_COUNT, Messages.IpcPlugin_0));
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   126
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   127
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   128
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   129
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceName()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   130
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   131
	public String getTraceName() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   132
		return "IPC"; //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   133
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   134
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   135
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   136
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceTitle()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   137
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   138
	public String getTraceTitle() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   139
		return Messages.IpcPlugin_1;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   140
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   141
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   142
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   143
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceId()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   144
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   145
	public int getTraceId() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   146
		return PEC_TRACE_ID;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   147
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   148
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   149
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   150
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#parseTraceFile(java.io.File)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   151
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   152
	public ParsedTraceData parseTraceFile(File file) throws Exception {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   153
		IpcTraceParser p = new IpcTraceParser();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   154
		ParsedTraceData ptd = p.parse(file);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   155
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   156
		return ptd;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   157
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   158
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   159
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   160
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#parseTraceFiles(java.io.File[])
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   161
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   162
	public ParsedTraceData parseTraceFiles(File[] files) throws Exception {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   163
		throw new UnsupportedOperationException();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   164
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   165
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   166
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   167
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IEventListener#receiveEvent(java.lang.String, org.eclipse.swt.widgets.Event)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   168
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   169
	public void receiveEvent(String action, Event event) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   170
		//no-op
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   171
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   172
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   173
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   174
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   175
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#arePagesCreated()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   176
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   177
	public boolean arePagesCreated() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   178
		return false; //PEC traces add graphs to existing pages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   179
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   180
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   181
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   182
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#createPage(int)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   183
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   184
	public ProfileVisualiser createPage(int index) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   185
		return null; //PEC traces add graphs to existing pages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   186
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   187
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   188
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   189
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getCreatePageCount()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   190
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   191
	public int getCreatePageCount() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   192
		return 0; //PEC traces don't create pages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   193
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   194
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   195
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   196
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getCreatePageIndex(int)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   197
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   198
	public int getCreatePageIndex(int index) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   199
		throw new UnsupportedOperationException(); //PEC traces don't create pages
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   200
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   201
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   202
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   203
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getDrawRequest(int)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   204
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   205
	public GraphDrawRequest getDrawRequest(int graphIndex) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   206
		return null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   207
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   208
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   209
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   210
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getGraphCount()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   211
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   212
	public int getGraphCount() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   213
		return GRAPH_COUNT;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   214
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   215
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   216
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   217
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getLastSample(int)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   218
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   219
	public Integer getLastSample(int graphIndex) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   220
		IpcTrace trace = (IpcTrace) NpiInstanceRepository.getInstance().activeUidGetTrace(PLUGIN_ID);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   221
		if(trace == null){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   222
			return 0;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   223
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   224
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   225
		return trace.getLastSampleNumber();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   226
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   227
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   228
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   229
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getPageNumber(int)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   230
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   231
	public int getPageNumber(int graphIndex) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   232
		if (graphIndex == 0) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   233
			return PIPageEditor.THREADS_PAGE;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   234
		} else if (graphIndex == 1) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   235
			return PIPageEditor.BINARIES_PAGE;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   236
		} else if (graphIndex == 2) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   237
			return PIPageEditor.FUNCTIONS_PAGE;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   238
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   239
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   240
		return PIPageEditor.NEXT_AVAILABLE_PAGE;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   241
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   242
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   243
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   244
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#getTraceGraph(int)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   245
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   246
	public IGenericTraceGraph getTraceGraph(int graphIndex) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   247
		int uid = NpiInstanceRepository.getInstance().activeUid();
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   248
		PecCommonGuiManager guiManager = GUI_MANAGER_MAP.get(uid);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   249
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   250
		if (guiManager != null){
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   251
			return guiManager.getTraceGraph(graphIndex, HELP_CONTEXT_ID_MAIN_PAGE);			
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   252
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   253
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   254
		throw new IllegalStateException();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   255
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   256
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   257
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   258
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#setPageIndex(int, int)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   259
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   260
	public void setPageIndex(int index, int pageIndex) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   261
		//no-op
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   262
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   263
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   264
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   265
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable#setPagesCreated(boolean)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   266
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   267
	public void setPagesCreated(boolean pagesCreated) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   268
		//no-op
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   269
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   270
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   271
	/**
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   272
	 * Returns a File corresponding to the given bundle relative path.
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   273
	 * @param path the bundle relative path to resource to locate
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   274
	 * @return the File corresponding to the given bundle relative path, or null
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   275
	 * @throws IOException
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   276
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   277
	public File locateFileInBundle(final String path) throws IOException {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   278
		Bundle myBundle= getDefault().getBundle();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   279
		IPath ppath= new Path(path);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   280
		ppath= ppath.makeRelative();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   281
		URL[] urls= FileLocator.findEntries(myBundle, ppath);
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   282
		if(urls.length != 1) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   283
			return null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   284
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   285
		return new File(FileLocator.toFileURL(urls[0]).getFile());
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   286
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   287
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   288
	
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   289
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   290
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IFinalizeTrace#runOnDispose()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   291
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   292
	public void runOnDispose() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   293
		// called when editor closes
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   294
		
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   295
		// Do any cleanup work here when the editor closes
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   296
		int uid = NpiInstanceRepository.getInstance().activeUid();
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   297
		GUI_MANAGER_MAP.remove(uid);
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   298
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   299
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   300
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   301
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IFinalizeTrace#runOnPartOpened()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   302
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   303
	public void runOnPartOpened() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   304
		// nothing to do
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   305
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   306
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   307
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   308
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IClassReplacer#getReplacedClass(java.lang.String)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   309
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   310
	public Class getReplacedClass(String className) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   311
		if (className.startsWith("com.nokia.carbide.cpp.pi.internal.ipc.IpcTrace")){ //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   312
			return IpcTrace.class;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   313
		} else if (className.startsWith("com.nokia.carbide.cpp.pi.internal.ipc.IpcSample")){//$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   314
			return IpcSample.class;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   315
		}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   316
		return null;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   317
	}
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   318
	
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   319
	/*
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   320
	 * (non-Javadoc)
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   321
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#isMandatory()
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   322
	 */
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   323
	public boolean isMandatory() {
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   324
		return false;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   325
	}
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   326
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   327
	/*
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   328
	 * (non-Javadoc)
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   329
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceDescription()
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   330
	 */
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   331
	public String getTraceDescription() {
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   332
		return getTraceTitle();
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   333
	}
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents:
diff changeset
   334
}