Search in sources :

Example 1 with HistogramDecoder

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

the class GmonView method setHistTitle.

/**
 * set the gprof view title
 *
 * @param decoder
 *            the gmon decoder
 * @param titleLabel
 *            the title label
 */
private static void setHistTitle(GmonDecoder decoder, Label titleLabel) {
    String title = // $NON-NLS-1$
    " gmon file: " + decoder.getGmonFile() + // $NON-NLS-1$
    "\n program file: " + decoder.getProgram().getPath() + // $NON-NLS-1$
    "\n" + " timestamp: " + // $NON-NLS-1$
    decoder.getGmonFileTimeStamp();
    HistogramDecoder histo = decoder.getHistogramDecoder();
    if (histo.hasValues()) {
        double prof_rate = histo.getProfRate();
        // $NON-NLS-1$
        String period = "";
        if (prof_rate != 0) {
            char tUnit = histo.getTimeDimension();
            switch(tUnit) {
                case 's':
                    prof_rate /= 1000000000;
                    break;
                case 'm':
                    prof_rate /= 1000000;
                    break;
                case 'u':
                    prof_rate /= 1000;
                    break;
            }
            // $NON-NLS-1$
            period = ", each sample counts as " + SampleProfField.getValue(1, prof_rate);
        }
        title += // $NON-NLS-1$
        "\n " + histo.getBucketSize() + " bytes per bucket" + // $NON-NLS-1$
        period;
    }
    titleLabel.setText(title);
    titleLabel.getParent().layout(true);
}
Also used : HistogramDecoder(org.eclipse.linuxtools.internal.gprof.parser.HistogramDecoder)

Example 2 with HistogramDecoder

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

the class SampleProfField method getProfRate.

protected double getProfRate() {
    double prof_rate = UNINITIALIZED;
    Object o = viewer.getViewer().getInput();
    if (o instanceof GmonDecoder) {
        GmonDecoder decoder = (GmonDecoder) o;
        HistogramDecoder histo = decoder.getHistogramDecoder();
        prof_rate = histo.getProfRate();
        char tUnit = histo.getTimeDimension();
        switch(tUnit) {
            case 's':
                prof_rate /= 1000000000;
                break;
            case 'm':
                prof_rate /= 1000000;
                break;
            case 'u':
                prof_rate /= 1000;
                break;
        }
    }
    return prof_rate;
}
Also used : GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) HistogramDecoder(org.eclipse.linuxtools.internal.gprof.parser.HistogramDecoder)

Aggregations

HistogramDecoder (org.eclipse.linuxtools.internal.gprof.parser.HistogramDecoder)2 GmonDecoder (org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder)1