|
Added
Link Here
|
| 1 |
/***************************************************************************** |
| 2 |
* Copyright (c) 2007, Intel Corporation. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* Intel Corporation - Initial API and implementation |
| 10 |
* Vitaly A. Provodin, Intel - Initial API and implementation |
| 11 |
* |
| 12 |
* $Id: |
| 13 |
*****************************************************************************/ |
| 14 |
package org.eclipse.tptp.platform.jvmti.client.internal.analysistypes; |
| 15 |
|
| 16 |
import java.util.Vector; |
| 17 |
|
| 18 |
import org.eclipse.core.runtime.CoreException; |
| 19 |
import org.eclipse.debug.core.ILaunchConfiguration; |
| 20 |
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
| 21 |
import org.eclipse.hyades.internal.execution.local.common.Options; |
| 22 |
import org.eclipse.swt.widgets.Composite; |
| 23 |
import org.eclipse.tptp.platform.jvmti.client.internal.ITILaunchConfigurationConstants; |
| 24 |
import org.eclipse.tptp.platform.jvmti.client.internal.TIMessages; |
| 25 |
import org.eclipse.tptp.platform.jvmti.client.internal.TIPlugin; |
| 26 |
import org.eclipse.tptp.trace.ui.internal.launcher.application.AbstractConfiguration; |
| 27 |
import org.eclipse.tptp.trace.ui.internal.launcher.application.PIMemoryAnalysisConf.MemoryConfigurationPage; |
| 28 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherMessages; |
| 29 |
import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; |
| 30 |
import org.eclipse.tptp.trace.ui.provisional.launcher.DataCollectionEngineAttribute; |
| 31 |
|
| 32 |
public class TIHeapAnalysisConfig extends AbstractConfiguration { |
| 33 |
|
| 34 |
public TIHeapAnalysisConfig() { |
| 35 |
super(new Class[] { TIHeapAnalysisOpt.class }); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* The heap analysis options are displayed in this configuration page. |
| 40 |
*/ |
| 41 |
public static class TIHeapAnalysisOpt extends MemoryConfigurationPage { |
| 42 |
|
| 43 |
/** The heap analysis UI */ |
| 44 |
private TIHeapAnalysisUI execHeapAnalysisUI; |
| 45 |
|
| 46 |
/** |
| 47 |
* Indicates whether object allocation site information should be |
| 48 |
* collected |
| 49 |
*/ |
| 50 |
private boolean collectObjectAllocationSite; |
| 51 |
|
| 52 |
public TIHeapAnalysisOpt() { |
| 53 |
execHeapAnalysisUI = new TIHeapAnalysisUI(); |
| 54 |
} |
| 55 |
|
| 56 |
public void reset(ILaunchConfiguration launchConfiguration) { |
| 57 |
try { |
| 58 |
collectObjectAllocationSite = launchConfiguration |
| 59 |
.getAttribute( |
| 60 |
ITILaunchConfigurationConstants.ATTR_EXEC_OBJ_ALLOC_SITE, |
| 61 |
false); |
| 62 |
} catch (CoreException e) { |
| 63 |
LauncherUtility.openErrorWithDetail( |
| 64 |
LauncherMessages.LAUNCHER_COMMON_ERROR_TITLE, |
| 65 |
TIMessages.ERROR_TI_CONFIGURATION_RESET, e); |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
public Vector getAttributes() { |
| 70 |
Vector options = null; |
| 71 |
options = new Vector(); |
| 72 |
options.add(new DataCollectionEngineAttribute( |
| 73 |
ITILaunchConfigurationConstants.ATTR_EXEC_OBJ_ALLOC_SITE, |
| 74 |
Options.OPTION_VALUE_TRUE)); |
| 75 |
return options; |
| 76 |
} |
| 77 |
|
| 78 |
public boolean storeAttributes( |
| 79 |
ILaunchConfigurationWorkingCopy configurationWC) { |
| 80 |
configurationWC.setAttribute( |
| 81 |
ITILaunchConfigurationConstants.ATTR_EXEC_OBJ_ALLOC_SITE, |
| 82 |
execHeapAnalysisUI.isCollectObjectAllocationSiteSelected()); |
| 83 |
return true; |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
public void createControl(Composite parent) { |
| 88 |
execHeapAnalysisUI.createControl(parent); |
| 89 |
execHeapAnalysisUI |
| 90 |
.setCollectObjectAllocationSite(collectObjectAllocationSite); |
| 91 |
} |
| 92 |
|
| 93 |
/* |
| 94 |
* (non-Javadoc) |
| 95 |
* |
| 96 |
* @see org.eclipse.tptp.trace.ui.internal.launcher.application.PIMemoryAnalysisConf.MemoryConfigurationPage#getDescription() |
| 97 |
*/ |
| 98 |
public String getDescription() { |
| 99 |
String desc = TIPlugin |
| 100 |
.getResourceString("JVMTI_ANALYSIS_TYPE_HEAP_OBJ_ALLOC_DESC"); |
| 101 |
return desc; |
| 102 |
} |
| 103 |
|
| 104 |
/* |
| 105 |
* (non-Javadoc) |
| 106 |
* |
| 107 |
* @see org.eclipse.tptp.trace.ui.internal.launcher.application.PIMemoryAnalysisConf.MemoryConfigurationPage#getTitle() |
| 108 |
*/ |
| 109 |
public String getTitle() { |
| 110 |
String title = TIPlugin |
| 111 |
.getResourceString("JVMTI_ANALYSIS_TYPE_HEAP_NAME"); |
| 112 |
return title; |
| 113 |
} |
| 114 |
} |
| 115 |
} |