blob: 522bfd0d2667b41deb5f2c60e5343ae07e9c4486 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*******************************************************************************
* Copyright (c) 2004, 2008, 2009 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Keith Seitz <keiths@redhat.com> - initial API and implementation
* Kent Sebastian <ksebasti@redhat.com>
*******************************************************************************/
package org.eclipse.linuxtools.internal.oprofile.launch;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.linuxtools.internal.oprofile.launch.configuration.EventConfigCache;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
*/
public class OprofileLaunchPlugin extends AbstractUIPlugin {
//The shared instance.
private static OprofileLaunchPlugin plugin;
//shared cache instance for configuration
private static EventConfigCache eventConfigCache = null;
public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.launch"; //$NON-NLS-1$
// The launch type ID for profiling
public static final String ID_LAUNCH_PROFILE = PLUGIN_ID + ".oprofile"; //$NON-NLS-1$
/* Launch Configuration attributes */
// Global options \\
public static final String ATTR_KERNEL_IMAGE_FILE = ID_LAUNCH_PROFILE + ".KERNEL_IMAGE"; //$NON-NLS-1$
public static final String ATTR_SEPARATE_SAMPLES = ID_LAUNCH_PROFILE + ".SEPARATE_SAMPLES"; //$NON-NLS-1$
public static final String ATTR_USE_DEFAULT_EVENT = ID_LAUNCH_PROFILE + ".USE_DEFAULT_EVENT"; //$NON-NLS-1$
public static final String ATTR_EXECUTIONS_NUMBER = ID_LAUNCH_PROFILE + ".EXECUTIONS_NUMBER"; //$NON-NLS-1$
/**
* @since 2.1
*/
public static final String ATTR_OPROFILE_COMBO_TEXT = ID_LAUNCH_PROFILE + ".OPROFILE_COMBO_TEXT"; //$NON-NLS-1$
// Counter Attributes \\
private static final String attrCounter(int nr) { return ID_LAUNCH_PROFILE + ".COUNTER_" + nr; } //$NON-NLS-1$
public static final String attrConterEnabled(int nr) { return attrCounter(nr) + ".ENABLED"; } //$NON-NLS-1$
public static final String attrConterEvent(int nr, int ev) { return attrCounter(nr) + ".EVENT " + ev; } //$NON-NLS-1$
public static final String attrCounterProfileKernel(int nr) { return attrCounter(nr) + ".PROFILE_KERNEL"; } //$NON-NLS-1$
public static final String attrCounterProfileUser(int nr) { return attrCounter(nr) + ".PROFILE_USER"; } //$NON-NLS-1$
public static final String attrCounterCount(int nr) { return attrCounter(nr) + ".COUNT"; } //$NON-NLS-1$
public static final String attrCounterUnitMask(int nr) { return attrCounter(nr) + ".UNIT_MASK"; } //$NON-NLS-1$
public static final String attrCounterUnitMaskName(int nr) { return attrCounter(nr) + ".UNIT_MASK_NAME"; } //$NON-NLS-1$
public static final String attrNumberOfEvents(int nr) { return attrCounter(nr) + ".EVENTS"; } //$NON-NLS-1$
public static final String ICON_PATH = "icons/"; //$NON-NLS-1$
public static final String ICON_EVENT_TAB = ICON_PATH + "event_tab.gif"; //$NON-NLS-1$
public static final String ICON_GLOBAL_TAB = ICON_PATH + "global_tab.gif"; //$NON-NLS-1$
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
}
public static OprofileLaunchPlugin getDefault() {
return plugin;
}
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
public static EventConfigCache getCache() {
if (eventConfigCache == null) {
eventConfigCache = new EventConfigCache();
}
return eventConfigCache;
}
}
|