Search in sources :

Example 6 with TreeElement

use of org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement in project linuxtools by eclipse.

the class NameProfField method getToolTipText.

@Override
public String getToolTipText(Object element) {
    TreeElement elem = (TreeElement) element;
    String s = elem.getSourcePath();
    if (s != null && !"??".equals(s)) {
        // $NON-NLS-1$
        int lineNumber = elem.getSourceLine();
        if (lineNumber > 0) {
            // $NON-NLS-1$
            return s + ":" + lineNumber;
        }
        return s;
    }
    return null;
}
Also used : TreeElement(org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement)

Example 7 with TreeElement

use of org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement in project linuxtools by eclipse.

the class SamplePerCallField method getNumber.

@Override
public Number getNumber(Object obj) {
    TreeElement e = (TreeElement) obj;
    int i = e.getSamples();
    int j = e.getCalls();
    if (i == -1 || j <= 0) {
        return 0L;
    }
    float k = (float) i / (float) j;
    double prof_rate = getProfRate();
    if (prof_rate != 0) {
        return k / prof_rate;
    } else {
        return 0L;
    }
}
Also used : TreeElement(org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement)

Example 8 with TreeElement

use of org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement in project linuxtools by eclipse.

the class SamplePerCallField method compare.

@Override
public int compare(Object obj1, Object obj2) {
    TreeElement e1 = (TreeElement) obj1;
    TreeElement e2 = (TreeElement) obj2;
    int c1 = e1.getCalls();
    int c2 = e2.getCalls();
    if ((c1 == 0 || c1 == -1) && (c2 == 0 || c2 == -1)) {
        return 0;
    }
    if (c1 == 0 || c1 == -1) {
        return -1;
    }
    if (c2 == 0 || c2 == -1) {
        return 1;
    }
    float f1 = (float) e1.getSamples() / (float) c1;
    float f2 = (float) e2.getSamples() / (float) c2;
    return Float.compare(f1, f2);
}
Also used : TreeElement(org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement)

Example 9 with TreeElement

use of org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement in project linuxtools by eclipse.

the class CallsProfField method getValue.

@Override
public String getValue(Object obj) {
    TreeElement e = (TreeElement) obj;
    int i = e.getCalls();
    if (i == -1) {
        // $NON-NLS-1$
        return "";
    }
    return String.valueOf(i);
}
Also used : TreeElement(org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement)

Example 10 with TreeElement

use of org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement in project linuxtools by eclipse.

the class CallsProfField method compare.

@Override
public int compare(Object obj1, Object obj2) {
    TreeElement e1 = (TreeElement) obj1;
    TreeElement e2 = (TreeElement) obj2;
    int s1 = e1.getCalls();
    int s2 = e2.getCalls();
    return s1 - s2;
}
Also used : TreeElement(org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement)

Aggregations

TreeElement (org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement)17 LinkedList (java.util.LinkedList)3 IBinaryObject (org.eclipse.cdt.core.IBinaryParser.IBinaryObject)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1