Search in sources :

Example 1 with ISymbol

use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.

the class HistogramDecoder method assignSamplesSymbol.

/**
 * Assign the hits to the given symbols
 * @param symblist
 */
public void assignSamplesSymbol() {
    if (hist_sample == null || hist_sample.length == 0)
        return;
    ISymbol[] symblist = this.decoder.getProgram().getSymbols();
    /* read samples and assign to namelist symbols */
    int j = 1;
    for (int i = 0; i < hist_sample.length; i++) {
        int ccnt = hist_sample[i];
        if (ccnt != 0) {
            long pcl = lowpc + (bucketSize * i);
            long pch = pcl + bucketSize;
            total_time += ccnt;
            long svalue0;
            long svalue1 = symblist[j - 1].getAddress().getValue().longValue();
            for (j = j - 1; j < symblist.length - 1; j++) {
                svalue0 = svalue1;
                svalue1 = symblist[j + 1].getAddress().getValue().longValue();
                /* if high end of tick is below entry address,
                     * go for next tick. */
                if (pch < svalue0) {
                    break;
                }
                /* if low end of tick into next routine,
                     * go for next routine. */
                if (pcl < svalue1) {
                    long start_addr = pcl > svalue0 ? pcl : svalue0;
                    long end_addr = pch < svalue1 ? pch : svalue1;
                    long overlap = end_addr - start_addr;
                    if (overlap > 0) {
                        ISymbol symbol = symblist[j];
                        int time = (int) ((overlap * ccnt) / bucketSize);
                        Bucket bck = new Bucket(start_addr, end_addr, time);
                        addBucket(bck, symbol);
                    }
                }
            }
        }
    }
}
Also used : ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol) Bucket(org.eclipse.linuxtools.internal.gprof.symbolManager.Bucket)

Example 2 with ISymbol

use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.

the class PPC64ElfBinaryObjectWrapper method getSymbols.

@Override
public ISymbol[] getSymbols() {
    if (symbols != null) {
        return symbols;
    }
    symbols = super.getSymbols();
    try {
        if (dataSection == null) {
            Elf elf = new Elf(getPath().toOSString());
            // $NON-NLS-1$
            dataSection = elf.getSectionByName(".data");
        }
    } catch (IOException e) {
    }
    // Failed to load data Section
    if (dataSection == null) {
        return symbols;
    }
    LinkedList<ISymbol> list = new LinkedList<>();
    for (ISymbol s : symbols) {
        if (s.getType() == ISymbol.FUNCTION && s instanceof Symbol) {
            IAddress addr = fixAddr(s.getAddress());
            if (addr == null) {
                addr = s.getAddress();
            }
            list.add(new Symbol((BinaryObjectAdapter) s.getBinaryObject(), s.getName(), s.getType(), addr, s.getSize()));
        } else {
            list.add(s);
        }
    }
    symbols = list.toArray(new Symbol[0]);
    Arrays.sort(symbols);
    return symbols;
}
Also used : BinaryObjectAdapter(org.eclipse.cdt.utils.BinaryObjectAdapter) ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol) Symbol(org.eclipse.cdt.utils.Symbol) ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol) IOException(java.io.IOException) Elf(org.eclipse.cdt.utils.elf.Elf) LinkedList(java.util.LinkedList) IAddress(org.eclipse.cdt.core.IAddress)

Example 3 with ISymbol

use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.

the class CGArc method getSamples.

@Override
public int getSamples() {
    Object o = this.getParent();
    CGCategory category = (CGCategory) o;
    ISymbol symbol;
    if (CGCategory.CHILDREN.equals(category.category)) {
        symbol = arc.child.getSymbol();
    } else {
        symbol = arc.parent.getSymbol();
    }
    return HistFunction.getSamples(symbol);
}
Also used : ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol)

Example 4 with ISymbol

use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.

the class CGArc method getSourceLine.

@Override
public int getSourceLine() {
    Object o = this.getParent();
    CGCategory category = (CGCategory) o;
    if (CGCategory.CHILDREN.equals(category.category)) {
        ISymbol symbol = arc.child.getSymbol();
        return STSymbolManager.sharedInstance.getLineNumber(symbol, arc.getProject());
    } else {
        return arc.parentLine;
    }
}
Also used : ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol)

Example 5 with ISymbol

use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.

the class HistFile method addCallGraphNode.

void addCallGraphNode(CallGraphNode node) {
    ISymbol s = node.getSymbol();
    HistFunction hf = getChild(s);
    hf.addCallGraphNode(node);
}
Also used : ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol)

Aggregations

ISymbol (org.eclipse.cdt.core.IBinaryParser.ISymbol)9 IAddress (org.eclipse.cdt.core.IAddress)2 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 IAddressFactory (org.eclipse.cdt.core.IAddressFactory)1 IBinaryObject (org.eclipse.cdt.core.IBinaryParser.IBinaryObject)1 BinaryObjectAdapter (org.eclipse.cdt.utils.BinaryObjectAdapter)1 Symbol (org.eclipse.cdt.utils.Symbol)1 Elf (org.eclipse.cdt.utils.elf.Elf)1 Bucket (org.eclipse.linuxtools.internal.gprof.symbolManager.Bucket)1