Search in sources :

Example 1 with GmonDecoder

use of org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder in project linuxtools by eclipse.

the class GprofParserTest method testProcessGmonFile.

@Test
public void testProcessGmonFile() throws IOException {
    IBinaryObject binary = STSymbolManager.sharedInstance.getBinaryObject(binaryFile.getAbsolutePath());
    final GmonDecoder gmondecoder = new GmonDecoder(binary, new PrintStream(parserDumpFile), null);
    gmondecoder.setShouldDump(true);
    gmondecoder.read(gmonFile.getAbsolutePath());
    STJunitUtils.compareIgnoreEOL(parserDumpFile.getAbsolutePath(), parserRefFile.getAbsolutePath(), true);
}
Also used : PrintStream(java.io.PrintStream) GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) Test(org.junit.Test)

Example 2 with GmonDecoder

use of org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder in project linuxtools by eclipse.

the class GprofTest method changeMode.

private void changeMode(GmonView view, boolean timeModeRequested) {
    AbstractSTTreeViewer gmonViewer = (AbstractSTTreeViewer) view.getSTViewer();
    GmonDecoder decoder = (GmonDecoder) gmonViewer.getInput();
    int prof_rate = decoder.getHistogramDecoder().getProfRate();
    if (prof_rate == 0) {
        return;
    }
    TreeColumn tc = gmonViewer.getViewer().getTree().getColumn(1);
    SampleProfField spf = (SampleProfField) tc.getData();
    if (spf.getColumnHeaderText().endsWith("Samples") ^ !timeModeRequested) {
        new SwitchSampleTimeAction(view).run();
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) SwitchSampleTimeAction(org.eclipse.linuxtools.internal.gprof.action.SwitchSampleTimeAction) AbstractSTTreeViewer(org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer) SampleProfField(org.eclipse.linuxtools.internal.gprof.view.fields.SampleProfField)

Example 3 with GmonDecoder

use of org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder in project linuxtools by eclipse.

the class SwitchSampleTimeAction method run.

@Override
public void run() {
    AbstractSTTreeViewer gmonViewer = (AbstractSTTreeViewer) view.getSTViewer();
    GmonDecoder decoder = (GmonDecoder) gmonViewer.getInput();
    if (decoder != null) {
        int prof_rate = decoder.getHistogramDecoder().getProfRate();
        if (prof_rate == 0) {
            MessageDialog.openError(view.getSite().getShell(), Messages.SwitchSampleTimeAction_GMON_PROF_RATE_IS_NULL, Messages.SwitchSampleTimeAction_GMON_PROF_RATE_IS_NULL_LONG_MSG);
            return;
        }
        TreeColumn tc = gmonViewer.getViewer().getTree().getColumn(1);
        SampleProfField spf = (SampleProfField) tc.getData();
        spf.toggle();
        tc.setText(spf.getColumnHeaderText());
        gmonViewer.getViewer().refresh();
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) AbstractSTTreeViewer(org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer) SampleProfField(org.eclipse.linuxtools.internal.gprof.view.fields.SampleProfField)

Example 4 with GmonDecoder

use of org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder in project linuxtools by eclipse.

the class CallGraphContentProvider method getElements.

@Override
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof GmonDecoder) {
        GmonDecoder obj = (GmonDecoder) inputElement;
        HistRoot root = obj.getRootNode();
        return new Object[] { root };
    }
    return new Object[0];
}
Also used : GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) HistRoot(org.eclipse.linuxtools.internal.gprof.view.histogram.HistRoot)

Example 5 with GmonDecoder

use of org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder in project linuxtools by eclipse.

the class FileHistogramContentProvider method getElements.

@Override
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof GmonDecoder) {
        GmonDecoder obj = (GmonDecoder) inputElement;
        HistRoot root = obj.getRootNode();
        return new Object[] { root };
    }
    return new Object[0];
}
Also used : GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) HistRoot(org.eclipse.linuxtools.internal.gprof.view.histogram.HistRoot)

Aggregations

GmonDecoder (org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder)9 IBinaryObject (org.eclipse.cdt.core.IBinaryParser.IBinaryObject)4 IOException (java.io.IOException)2 Path (org.eclipse.core.runtime.Path)2 AbstractSTTreeViewer (org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer)2 SampleProfField (org.eclipse.linuxtools.internal.gprof.view.fields.SampleProfField)2 HistRoot (org.eclipse.linuxtools.internal.gprof.view.histogram.HistRoot)2 TreeColumn (org.eclipse.swt.widgets.TreeColumn)2 File (java.io.File)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 LineNumberReader (java.io.LineNumberReader)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 IAction (org.eclipse.jface.action.IAction)1 STExportToCSVAction (org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction)1 SwitchSampleTimeAction (org.eclipse.linuxtools.internal.gprof.action.SwitchSampleTimeAction)1 HistogramDecoder (org.eclipse.linuxtools.internal.gprof.parser.HistogramDecoder)1