diff options
19 files changed, 286 insertions, 69 deletions
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpcontrolProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpcontrolProvider.java index 82a97087dd..2f34b05ccf 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpcontrolProvider.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpcontrolProvider.java @@ -85,12 +85,23 @@ public interface IOpcontrolProvider { /** * Delete the session with the specified name for the specified event * @param sessionName The name of the session to delete - * @param eventName The name of the event containing the session + * @param sessionEvent The name of the event containing the session * @throws OpcontrolException */ public void deleteSession (String sessionName, String sessionEvent) throws OpcontrolException; + /** + * Check if the user has permission to run opcontrol + * @param project The project to be run + * @return true if the user has sudo permission to run opcontrol, otherwise false + * @throws OpcontrolException + */ public boolean hasPermissions(IProject project) throws OpcontrolException; + /** + * Check status and return true if any status was returned + * @return true if any status was returned, otherwise false + * @throws OpcontrolException + */ public boolean status() throws OpcontrolException; } diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpxmlProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpxmlProvider.java index 0fb8311679..e398bad69d 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpxmlProvider.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/IOpxmlProvider.java @@ -53,7 +53,7 @@ public interface IOpxmlProvider { public IRunnableWithProgress checkEvents(int ctr, String event, int um, int[] eventValid); /** - * Returns an /code>IRunnableWithProgress</code> that fetches the list of sessions + * Returns an <code>IRunnableWithProgress</code> that fetches the list of sessions * @param info the <code>OpInfo</code> for oprofile * @param sessionList an <code>ArrayList</code> in which to return the list of sessions * @return <code>IRunnableWithProgress</code> that may be run by the caller diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OpcontrolException.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OpcontrolException.java index 3f39942cea..ce7450a096 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OpcontrolException.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OpcontrolException.java @@ -13,11 +13,19 @@ package org.eclipse.linuxtools.internal.oprofile.core; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; - +/** +* OpcontrolException class represents a failure +* It extends super class CoreExceptions which contains a status object describing +* the cause of the exception. +*/ public class OpcontrolException extends CoreException { //without this there's a warning.. private static final long serialVersionUID = 8508930482724912901L; + /** + * Constructor to this class + * @param status The status object of this exception + */ public OpcontrolException(IStatus status) { super(status); } diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java index 28456f3399..08fd23fb5f 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/Oprofile.java @@ -39,10 +39,14 @@ public class Oprofile "/proc/sys/dev/oprofile/cpu_type" //$NON-NLS-1$ }; - // Oprofile information + /** + * Oprofile information + */ private static OpInfo info; - // Make sure that oprofile is ready to go + /** + * Make sure that oprofile is ready to go + */ static { initializeOprofileModule(); } @@ -73,6 +77,10 @@ public class Oprofile // but it is the only way of knowing whether the module is loaded (and we can // succesfully call into the oprofile wrapper library without causing it to print out // a lot of warnings). + /** + * Check whether oprofile kernel module is loaded + * @return true if the module is loaded, otherwise false + */ private static boolean isKernelModuleLoaded() { IRemoteFileProxy proxy = null; try { @@ -90,7 +98,9 @@ public class Oprofile return false; } - // initialize oprofile module by calling `opcontrol --init` + /** + * Initialize oprofile module by calling <code>`opcontrol --init`</code> + */ private static void initializeOprofile() { try { OprofileCorePlugin.getDefault().getOpcontrolProvider().initModule(); @@ -100,7 +110,9 @@ public class Oprofile } - // Initializes static data for oprofile. + /** + * Initializes static data for oprofile. + */ private static void initializeOprofileCore () { if (isKernelModuleLoaded()){ info = OpInfo.getInfo(); @@ -235,6 +247,7 @@ public class Oprofile } /** + * Check if oprofile kernel module is loaded and update Oprofile's information. * @since 1.1 */ public static void updateInfo(){ @@ -250,15 +263,24 @@ public class Oprofile // is being profiled in order to get the path for the Linux Tools' binaries set for that project. // For this reason the project property has to be set outside the Oprofile class /** + * OProfileProject class to set/get which project is being profiled * @since 1.1 */ public static class OprofileProject { private static IProject project; + /** + * Set the project to be profiled + * @param project + */ public static void setProject(IProject project) { OprofileProject.project = project; } + /** + * Get the project to be profiled + * @return project + */ public static IProject getProject() { return project; } diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OprofileCorePlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OprofileCorePlugin.java index 6f9e15b951..b43f37f351 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OprofileCorePlugin.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/OprofileCorePlugin.java @@ -159,6 +159,12 @@ public class OprofileCorePlugin extends Plugin { return opcontrolProvider; } + /** + * Creates an error status object + * @param errorClassString A string of the error class + * @param e The type of exception + * @return the status object of the error + */ public static IStatus createErrorStatus(String errorClassString, Exception e) { String statusMessage = OprofileProperties.getString(errorClassString + ".error.statusMessage"); //$NON-NLS-1$ @@ -169,6 +175,11 @@ public class OprofileCorePlugin extends Plugin { } } + /** + * Shows an error Dialog + * @param errorClassString A string of the error class + * @param ex The type of exception + */ public static void showErrorDialog(String errorClassString, CoreException ex) { final IStatus status; final String dialogTitle = OprofileProperties.getString(errorClassString + ".error.dialog.title"); //$NON-NLS-1$ @@ -204,8 +215,8 @@ public class OprofileCorePlugin extends Plugin { /** * Log a string message with the given severity in the error log. * - * @param severity - * @param msg + * @param severity the severity of this exception + * @param msg the string message to be logged */ public static void log(int severity, String msg) { plugin.getLog().log(new Status(severity, PLUGIN_ID, IStatus.OK, msg, null)); @@ -214,9 +225,9 @@ public class OprofileCorePlugin extends Plugin { /** * Log an exception in the error log. * - * @param severity - * @param msg - * @param cause + * @param severity the severity of this exception + * @param msg The message to be logged + * @param cause object representing the cause of this exception */ public static void log(int severity, String msg, Throwable cause) { plugin.getLog().log(new Status(severity, PLUGIN_ID, IStatus.OK, msg, cause)); diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpEvent.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpEvent.java index f20262fbb9..2e19814901 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpEvent.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpEvent.java @@ -16,16 +16,24 @@ package org.eclipse.linuxtools.internal.oprofile.core.daemon; * A class which represents an Oprofile event */ public class OpEvent { - // The Oprofile event name, i.e., "CPU_CLK_UNHALTED" + /** + * The Oprofile event name, i.e., "CPU_CLK_UNHALTED" + */ private String name; - // A description of the event + /** + * A description of the event + */ private String description; - // Unit masks for this event type + /** + * Unit masks for this event type + */ private OpUnitMask unitMask; - // Minimum count + /** + * Minimum count + */ private int minCount; /** diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpInfo.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpInfo.java index b2ed8087c2..a83bd9f8c8 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpInfo.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpInfo.java @@ -32,16 +32,20 @@ public class OpInfo { public static final String DEFAULT_LOG_FILE = DefaultsProcessor.LOG_FILE; public static final String DEFAULT_DUMP_STATUS = DefaultsProcessor.DUMP_STATUS; - // A comparator class used when sorting events - // (sorting by event name) + /** + * A comparator class used when sorting events + * (sorting by event name) + */ private static class SortEventComparator implements Comparator<OpEvent> { public int compare(OpEvent o1, OpEvent o2) { return o1.getText().compareTo(o2.getText()); } } - // A comparator class used when searching events - // (searching by event name) + /** + * A comparator class used when searching events + * (searching by event name) + */ private static class SearchEventComparator implements Comparator<Object> { public int compare(Object a, Object b) { String astr, bstr; @@ -56,19 +60,29 @@ public class OpInfo { } } - // The number of counters supported by this configuration + /** + * The number of counters supported by this configuration + */ private int nrCounters; - // A HashMap of Oprofile defaults + /** + * A HashMap of Oprofile defaults + */ private HashMap<String,String> defaults; - // The permanent list of events indexed by counter + /** + * The permanent list of events indexed by counter + */ private OpEvent[][] eventList; - // The CPU frequency of this CPU in MHz + /** + * The CPU frequency of this CPU in MHz + */ private double cpuSpeed; - // Whether or not oprofile is running in timer mode + /** + * Whether or not oprofile is running in timer mode + */ private boolean timerMode; /** diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpUnitMask.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpUnitMask.java index 22740cd0fd..89c068ec00 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpUnitMask.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OpUnitMask.java @@ -58,20 +58,30 @@ public class OpUnitMask { public static final int BITMASK = 3; - // The current value of this unitmask + /** + * The current value of this unitmask + */ private int mask; - // The default mask provided by the oprofile library + /** + * The default mask provided by the oprofile library + */ private int defaultMask; - // The type of this unitmask + /** + * The type of this unitmask + */ private int maskType; - // Descriptions of the bits of this mask + /** + * Descriptions of the bits of this mask + */ private String[] maskOptionDescriptions = new String[0]; - // mask values -- now bit masks have distinct values (eg: an all of the - // above) + /** + * mask values -- now bit masks have distinct values (eg: an all of the above) + */ + private int[] maskOptionValues; /** diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonEvent.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonEvent.java index c93f9d741e..4875fa27dc 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonEvent.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonEvent.java @@ -22,16 +22,24 @@ public class OprofileDaemonEvent { public static final int COUNT_UNINITIALIZED = 0; public static final int COUNT_INVALID = -1; - // The event to collect on this counter + /** + * The event to collect on this counter + */ private OpEvent event; - // Profile kernel? + /** + * Boolean variable to enable/disable Profile kernel + */ private boolean profileKernel; - // Profile userspace? + /** + * Boolean variable to enable/disable Profile userspace + */ private boolean profileUser; - // Reset counter value + /** + * Reset counter value + */ private int count; public OprofileDaemonEvent() { diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonOptions.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonOptions.java index b0dd3e8978..a693012c82 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonOptions.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/daemon/OprofileDaemonOptions.java @@ -17,19 +17,29 @@ package org.eclipse.linuxtools.internal.oprofile.core.daemon; * OProfile daemon. */ public class OprofileDaemonOptions { - // Kernel image file + /** + * Kernel image file + */ private String kernelImageFile; - // Enable verbose logging? + /** + * Enable verbose logging + */ private boolean verboseLogging; - // How to separate profiles (mask) + /** + * How to separate profiles (mask) + */ private int separateProfiles; - // the image to profile + /** + * The image to profile + */ private String binaryImage; - //how many calls down to profile + /** + * How many calls down to profile + */ private int callgraphDepth; /** @@ -49,6 +59,9 @@ public class OprofileDaemonOptions { public static final int SEPARATE_THREAD = 4; public static final int SEPARATE_CPU = 8; + /** + * Constructor + */ public OprofileDaemonOptions() { //defaults kernelImageFile = ""; //$NON-NLS-1$ diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/LinuxOpcontrolProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/LinuxOpcontrolProvider.java index 86a2f5652b..b8f8548a81 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/LinuxOpcontrolProvider.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux/LinuxOpcontrolProvider.java @@ -41,12 +41,16 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { private static final int SUDO_TIMEOUT = 2000; - // Location of opcontrol security wrapper + /** + * Location of opcontrol security wrapper + */ private static final String OPCONTROL_REL_PATH = "natives/linux/scripts/" + OPCONTROL_EXECUTABLE; //$NON-NLS-1$ private static boolean isInstalled; - // Initialize the Oprofile kernel module and oprofilefs + /** + * Initialize the Oprofile kernel module and oprofilefs + */ private static final String OPD_INIT_MODULE = "--init"; //$NON-NLS-1$ // Setup daemon collection arguments @@ -239,6 +243,12 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { } // Convenience function + /** + * Run opcontrol process + * @param cmd opcontrol daemon argument + * @return true if any output was produced on the error stream, false otherwise + * @throws OpcontrolException + */ private boolean runOpcontrol(String cmd) throws OpcontrolException { ArrayList<String> list = new ArrayList<String>(); list.add(cmd); @@ -248,6 +258,8 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { // Will add opcontrol program to beginning of args // args: list of opcontrol arguments (not including opcontrol program itself) /** + * Run opcontrol process + * @param args list of opcontrol command and arguments * @return true if any output was produced on the error stream. Unfortunately * this appears to currently be the only way we can tell if user correctly * entered the password @@ -278,9 +290,10 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { } /** - * @param cmdArray - * @param project - * @return + * Create opcontrol process + * @param cmdArray array of opcontrol command and arguments + * @param project project to be profiled + * @return p opcontrol process * @throws OpcontrolException * @since 1.1 */ @@ -304,10 +317,11 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { } /** - * @since 1.1 - * @param p - * @return + * Check opcontrol process + * @param p opcontrol process + * @return true if any output was produced on the error stream, false otherwise * @throws OpcontrolException + * @since 1.1 */ protected boolean checkOpcontrolProcess(Process p) throws OpcontrolException { if (p != null) { @@ -364,6 +378,8 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { } /** + * Search for opcontrol executable on the system + * @return a string path to opcontrol executable * @since 1.1 */ protected String findOpcontrolExecutable() { @@ -389,7 +405,11 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { return null; } - // Convert the event into arguments for opcontrol + /** + * Convert the event into arguments for opcontrol + * @param args List of arguments + * @param event The event to be passed as argument to opcontrol + */ private void eventToArguments(ArrayList<String> args, OprofileDaemonEvent event) { // Event spec: "EVENT:count:mask:profileKernel:profileUser" StringBuilder spec = new StringBuilder(); @@ -406,7 +426,11 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { args.add(spec.toString()); } - // Convert the options into arguments for opcontrol + /** + * Convert the options into arguments for opcontrol + * @param args List of arguments + * @param options The launch options to oprofile daemon + */ private void optionsToArguments(ArrayList<String> args, OprofileDaemonOptions options) { // Add separate flags int mask = options.getSeparateProfilesMask(); @@ -447,8 +471,8 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { /** * Checks if the user has permissions to execute opcontrol as root without providing password * and if opcontrol exists in the indicated path - * @param project - * @return + * @param project The project to be profiled + * @return true if the user has sudo permission to run opcontrol, false otherwise * @throws OpcontrolException if opcontrol not installed * @since 1.1 */ @@ -517,6 +541,10 @@ public class LinuxOpcontrolProvider implements IOpcontrolProvider { return false; } + /** + * Check if opcontrol is installed on the system + * @return true if opcontrol is installed, otherwise false + */ private boolean isInstalled(){ findOpcontrolExecutable(); return isInstalled; diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/DependentProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/DependentProcessor.java index f566e5520d..7d620f5bd8 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/DependentProcessor.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/DependentProcessor.java @@ -31,12 +31,17 @@ public class DependentProcessor extends XMLProcessor { private static final String ATTR_IMAGENAME = "name"; //$NON-NLS-1$ private static final String ATTR_COUNT = "count"; //$NON-NLS-1$ - //the current image being constructed + /** + * the current image being constructed + */ private OpModelImage image; - //a list of all the dependent images + /** + * a list of all the dependent images + */ private ArrayList<OpModelImage> imageList; - - //processor used for symbols of an image + /** + * processor used for symbols of an image + */ private SymbolsProcessor _symbolsProcessor = new SymbolsProcessor(); @Override @@ -44,7 +49,9 @@ public class DependentProcessor extends XMLProcessor { image = new OpModelImage(); imageList = new ArrayList<OpModelImage>(); } - + /** + * @see org.eclipse.linuxtools.internal.oprofile.core.XMLProcessor#startElement(String) + */ @Override public void startElement(String name, Attributes attrs, Object callData) { if (name.equals(IMAGE_TAG)) { diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataAdapter.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataAdapter.java index e7b74dccba..ec090f4298 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataAdapter.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataAdapter.java @@ -75,6 +75,10 @@ public class ModelDataAdapter extends AbstractDataAdapter { private Element oldRoot; // the root of the document with data from opreport private Element newRoot; // the root of the document we intent to build + /** + * Constructor to the ModelAdapter class + * @param is The input stream to be parsed + */ public ModelDataAdapter(InputStream is) { isParseable = true; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); @@ -360,6 +364,10 @@ public class ModelDataAdapter extends AbstractDataAdapter { } }; + /** + * Returns if parseable + * @return isParseable boolean variable + */ public boolean isParseable() { return isParseable; } diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataProcessor.java index 2087234940..607ccbd318 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataProcessor.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/ModelDataProcessor.java @@ -52,7 +52,9 @@ public class ModelDataProcessor extends XMLProcessor { image = ((CallData) callData).opModelImage; imgSeen = 0; } - + /** + * @see org.eclipse.linuxtools.internal.oprofile.core.opxml.XMLProcessor#startElement() + */ @Override public void startElement(String name, Attributes attrs, Object callData) { if (name.equals(IMAGE_TAG)) { @@ -72,6 +74,9 @@ public class ModelDataProcessor extends XMLProcessor { } } + /** + * @see org.eclipse.linuxtools.internal.oprofile.core.opxml.XMLProcessor#endElement() + */ @Override public void endElement(String name, Object callData) { if (name.equals(IMAGE_TAG)) { diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SamplesProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SamplesProcessor.java index 7419dde6b6..6843ce1930 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SamplesProcessor.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SamplesProcessor.java @@ -35,6 +35,9 @@ public class SamplesProcessor extends XMLProcessor { //a list of all samples (for this symbol) private ArrayList<OpModelSample> sampleList; + /** + * @see org.eclipse.linuxtools.internal.oprofile.core.XMLProcessor#reset() + */ @Override public void reset(Object callData) { sample = new OpModelSample(); @@ -60,6 +63,10 @@ public class SamplesProcessor extends XMLProcessor { } } + /** + * Return oprofile samples + * @return samples An array of oprofile samples + */ public OpModelSample[] getSamples() { OpModelSample[] samples = new OpModelSample[sampleList.size()]; sampleList.toArray(samples); diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SymbolsProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SymbolsProcessor.java index 347597bb74..37a9943211 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SymbolsProcessor.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/modeldata/SymbolsProcessor.java @@ -32,12 +32,16 @@ public class SymbolsProcessor extends XMLProcessor { private static final String ATTR_COUNT = "count"; //$NON-NLS-1$ private static final String ATTR_LINE = "line"; //$NON-NLS-1$ - //the current symbol being constructed + /** + * The current symbol being constructed + */ private OpModelSymbol symbol; //all the symbols in this <symbols> tag, to be returned to the calling ModelDataProcessor private ArrayList<OpModelSymbol> symbols; - //the processor used for individual samples + /** + * The processor used for individual samples + */ private SamplesProcessor samplesProcessor = new SamplesProcessor(); @@ -76,7 +80,10 @@ public class SymbolsProcessor extends XMLProcessor { } } - //return all parsed samples + /** + * Return all parsed samples + * @return s the parsed symbols + */ public OpModelSymbol[] getSymbols() { OpModelSymbol [] s = new OpModelSymbol[symbols.size()]; symbols.toArray(s); diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java index 729376e6e5..75cc4fd97e 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionManager.java @@ -59,6 +59,10 @@ public class SessionManager { write(); } + /** + * Session manager class constructor to manipulate the XML data + * @param file the xml file + */ public SessionManager(File file) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; @@ -106,7 +110,11 @@ public class SessionManager { } } } - + /** + * Check if a session exists + * @param sessionName the name of the session + * @return true if the session exists, otherwise false + */ public boolean existsSession (String sessionName){ return find (root, SESSION, NAME, sessionName) != null ? true : false; } @@ -183,6 +191,7 @@ public class SessionManager { } /** + * Return a list of the events run with the given session * @param sessionName the name of the session * @return A String ArrayList of event names that were run with the * given session. diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionsProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionsProcessor.java index 1c9a4f4e43..c5eed60667 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionsProcessor.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/opxml/sessions/SessionsProcessor.java @@ -24,7 +24,9 @@ import org.xml.sax.Attributes; */ public class SessionsProcessor extends XMLProcessor { public static class SessionInfo { - // A list of SessionEvents + /** + * A list of SessionEvents + */ public ArrayList<OpModelEvent> list; public SessionInfo(ArrayList<OpModelEvent> list){ @@ -39,16 +41,22 @@ public class SessionsProcessor extends XMLProcessor { public static final String EVENT_TAG = "event"; //$NON-NLS-1$ private static final String EVENT_NAME_ATTR = "name"; //$NON-NLS-1$ - // The current session being constructed + /** + * The current session being constructed + */ private OpModelSession currentSession; - // The current event being constructed + /** + * The current event being constructed + */ private OpModelEvent currentEvent; - // A list of all sessions + /** + * A list of all sessions + */ private ArrayList<OpModelSession> sessionList; - /* (non-Javadoc) + /** * @see org.eclipse.linuxtools.internal.oprofile.core.opxml.XMLProcessor#startElement(java.lang.String, org.xml.sax.Attributes, java.lang.Object) */ @Override @@ -65,7 +73,7 @@ public class SessionsProcessor extends XMLProcessor { } } - /* (non-Javadoc) + /** * @see org.eclipse.linuxtools.internal.oprofile.core.opxml.XMLProcessor#endElement(java.lang.String, java.lang.Object) */ @Override diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/model/UiModelSample.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/model/UiModelSample.java index b255772663..d4b4fcf8c0 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/model/UiModelSample.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/model/UiModelSample.java @@ -20,6 +20,12 @@ public class UiModelSample implements IUiModelElement { private OpModelSample sample; //the node in the data model private int totalCount; //total sample count for the parent session + /** + * Constructor to the UiModelSample class + * @param parent The parent element + * @param sample Oprofile sample node in the data model + * @param totalCount The total sample count for the parent session + */ public UiModelSample(IUiModelElement parent, OpModelSample sample, int totalCount) { this.parent = parent; this.sample = sample; @@ -34,14 +40,26 @@ public class UiModelSample implements IUiModelElement { return percentage + " " + OprofileUiMessages.getString("uimodel.sample.on.line") + Integer.toString(sample.getLine()); //$NON-NLS-1$ //$NON-NLS-2$ } + /** + * Return the sample line + * @return the sample line + */ public int getLine() { return sample.getLine(); } + /** + * Return the path to the sample node + * @return node path + */ public String getFile(){ return sample.getFilePath(); } + /** + * Returns the count percentage for the sample node + * @return count percentage for the sample node + */ public double getCountPercentage() { return (double)sample.getCount() / (double)totalCount; } @@ -51,18 +69,33 @@ public class UiModelSample implements IUiModelElement { return toString(); } + /** + * Returns this element children + * @return An array of IUiModelElements + */ public IUiModelElement[] getChildren() { return null; } - + /** + * Returns if the element has any children. + * @return true if the element has children, false otherwise + */ public boolean hasChildren() { return false; //bottom level element } + /** + * Returns the element's parent. + * @return parent The parent element + */ public IUiModelElement getParent() { return parent; } + /** + * Returns the Image to display next to the text in the tree viewer. + * @return an Image object of the icon + */ public Image getLabelImage() { return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.SAMPLE_ICON).createImage(); } |