Esempio n. 1
0
def run(s, intp=None, **kwargs):
    if intp is None:
        intp = Interpreter()

    for i in kwargs:
        intp.curr[i] = kwargs[i]

    return intp.run(analyze.parse(s))
def initObjDict(objDict,fileName):
    g = analyze.HeapGraph()
    with open(fileName,'r') as f:
        l = analyze.parse(g,f)
    del g
    for outData in l:
        if outData.special or not outData.backtraces:
            continue
        bt = backtrace_element(outData.backtraces)
        if bt not in objDict:
            objDict[bt] = OldObjectDesc(outData.size,outData.backtraces)
        else:
            oldDesc = objDict[bt]
            oldDesc.allocations += outData.size
def initObjDict(objDict,fileName):
    g = analyze.HeapGraph()
    generalList = None
    with open(fileName,'rb') as f:
        generalList = analyze.parse(g,f)

    for outData in generalList:
        if not outData.backtraces:
            continue
        backtrace = backtrace_element(outData.backtraces)
        if backtrace not in objDict:
            objDict[backtrace] = OldObjectDesc(outData.size,outData.backtraces)
        else:
            oldDesc = objDict[backtrace]
            oldDesc.allocations +=  outData.size
Esempio n. 4
0
def initObjDict(objDict, fileName):
    g = analyze.HeapGraph()
    generalList = None
    with open(fileName, 'rb') as f:
        generalList = analyze.parse(g, f)

    for outData in generalList:
        if not outData.backtraces:
            continue
        backtrace = backtrace_element(outData.backtraces)
        if backtrace not in objDict:
            objDict[backtrace] = OldObjectDesc(outData.size,
                                               outData.backtraces)
        else:
            oldDesc = objDict[backtrace]
            oldDesc.allocations += outData.size
Esempio n. 5
0
import sys
import analyze
import importlib

part1Cache = None
if __name__ == "__main__":
    while True:
        if not part1Cache:
            part1Cache = analyze.parse(sys.argv[1])
        analyze.analyze(part1Cache)
        print("Press enter to re-run the script, CTRL-C to exit")
        sys.stdin.readline()
        importlib.reload(analyze)
    myoptparser.add_option("-m","--map-file",help="assign map file",action="store", type="string", dest="mapfile")
    myoptparser.add_option("-s","--symbol-path",help="assign symbol path",action="store", type="string", dest="sympath")
    myoptparser.add_option("-w","--writer",help="set a writer by name",action="store", type="string", dest="writer")
    
    myargTuple = myoptparser.parse_args() 

    if not myargTuple[0].mapfile:
        printError("need to use -m to specify map file")

    if not myargTuple[0].sympath:
        printError('need to use -s to specify sym file')

    #initialize generalList
    with open(myargTuple[1][0],"rb") as f:
        g = analyze.HeapGraph()
        generalList = analyze.parse(g,f)
    
    generalList.sort()
    del g
    #kick off address filter to get line numbers for object analysis
    process = subprocess.Popen(("python","AddressFilter.py",myargTuple[0].mapfile,myargTuple[0].sympath),stdout=subprocess.PIPE,stdin=subprocess.PIPE)
    
    def thread_call_back(returnList):
        sortedBackTrace = analyze.printBackTrace(generalList,process.stdin)
        process.stdin.close()
        returnList.append(sortedBackTrace)
    #start thread to fill subprocess
    returnList = []
    workerThread = threading.Thread(target=thread_call_back,name='backtrace_print',kwargs={'returnList':returnList})
    workerThread.start()