Search in sources :

Example 11 with TreeElement

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

the class NameProfField method compare.

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

Example 12 with TreeElement

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

the class RatioProfField method getPercentage.

/**
 * Gets the percentage value to display.
 * @param obj The TreeElement to retrieve percentage value for.
 * @return The percentage value to display.
 */
@Override
public float getPercentage(Object obj) {
    TreeElement e = (TreeElement) obj;
    int SamplesSum = e.getRoot().getSamples();
    if (SamplesSum == 0) {
        return 0;
    } else
        return ((100.0f * e.getSamples()) / e.getRoot().getSamples());
}
Also used : TreeElement(org.eclipse.linuxtools.internal.gprof.view.histogram.TreeElement)

Example 13 with TreeElement

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

the class RatioProfField method compare.

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

Example 14 with TreeElement

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

the class SamplePerCallField method getValue.

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

Example 15 with TreeElement

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

the class SampleProfField method compare.

@Override
public int compare(Object obj1, Object obj2) {
    TreeElement e1 = (TreeElement) obj1;
    TreeElement e2 = (TreeElement) obj2;
    int s1 = e1.getSamples();
    int s2 = e2.getSamples();
    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