Beispiel #1
0
 /**
  * Display gmon results in the GProf View. NOTE: this method has to be called from within the UI
  * thread.
  *
  * @param decoder
  * @param id Secondary id, usually path to gmon file.
  */
 public static GmonView displayGprofView(GmonDecoder decoder, String id) {
   GmonView gmonview = null;
   try {
     IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
     IWorkbenchPage page = window.getActivePage();
     if (id != null) {
       id = id.replace('.', '_');
       id = id.replace(':', '_');
     }
     gmonview = (GmonView) page.showView(ID, id, IWorkbenchPage.VIEW_ACTIVATE);
     if (decoder.getHistogramDecoder().getProfRate() == 0) {
       gmonview.switchSampleTime.setToolTipText(
           "Unable to display time, because profiling rate is null"); //$NON-NLS-1$
       gmonview.switchSampleTime.setEnabled(false);
     }
     gmonview.setInput(decoder);
     GmonView.setHistTitle(decoder, gmonview.label);
     if (!decoder.getHistogramDecoder().hasValues()) {
       gmonview.action1.setChecked(true);
       gmonview.action2.setChecked(false);
       gmonview.action1.run();
     }
   } catch (CoreException e) {
     Status status =
         new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e);
     Activator.getDefault().getLog().log(status);
   }
   return gmonview;
 }
Beispiel #2
0
  /**
   * Display gmon results in the GProf View. NOTE: this method has to be called from within the UI
   * thread.
   *
   * @param binaryPath
   * @param gmonPath
   * @param instanceName
   */
  public static GmonView displayGprofView(String binaryPath, String gmonPath, IProject project) {
    IBinaryObject binary = STSymbolManager.sharedInstance.getBinaryObject(new Path(binaryPath));
    if (binary == null) {
      MessageDialog.openError(
          PlatformUI.getWorkbench().getDisplay().getActiveShell(),
          "Invalid binary file", //$NON-NLS-1$
          binaryPath + " is not a valid binary file."); // $NON-NLS-1$
      return null;
    } else if (binary.getCPU().equals("ppc64")) // $NON-NLS-1$
    binary =
          new PPC64ElfBinaryObjectWrapper(
              binary.getBinaryParser(), binary.getPath(), binary.getType());

    GmonDecoder decoder = new GmonDecoder(binary, project);
    try {
      decoder.read(gmonPath);
    } catch (IOException e) {
      Status status =
          new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e);
      Activator.getDefault().getLog().log(status);
    }
    return displayGprofView(decoder, gmonPath);
  }