Public Member Functions | |
def | __init__ |
Public Attributes | |
functionNameToId | |
idToFunctionInfo | |
paths |
Definition at line 42 of file profilereader.py.
def profilereader::ProfileData::__init__ | ( | self, | |
filesToUseInfo, | |||
feedBackStream = None |
|||
) |
Definition at line 43 of file profilereader.py.
00044 : 00045 #try to determine the filePrefix from the value given 00046 # since caller may have given us just one of the files 00047 # instead of the prefix to the files 00048 (dir,base) = os.path.split(filesToUseInfo) 00049 uniqueID = base.split('_')[1] 00050 filePrefix = os.path.join(dir,"profdata_"+uniqueID+"_") 00051 if feedBackStream: 00052 feedBackStream.write('reading file: '+filePrefix+'names') 00053 nameFile = file(filePrefix+'names','r') 00054 self.idToFunctionInfo = dict() 00055 self.functionNameToId = dict() 00056 feedbackIndex = 0 00057 for line in nameFile: 00058 if feedBackStream and (0 == feedbackIndex % 100): 00059 feedBackStream.write('.') 00060 feedbackIndex +=1 00061 infoList = line.split('\t') 00062 self.idToFunctionInfo.setdefault( int(infoList[0]), FunctionInfo(infoList[1:])) 00063 self.functionNameToId.setdefault(self.idToFunctionInfo[int(infoList[0])].name, int(infoList[0])) 00064 if feedBackStream: 00065 feedBackStream.write('\nreading file: '+filePrefix+'paths') 00066 pathFile = file(filePrefix+'paths','r') 00067 self.paths = list() 00068 feedbackIndex = 0 00069 for line in pathFile: 00070 if feedBackStream and (0 == feedbackIndex % 100): 00071 feedBackStream.write('.') 00072 feedbackIndex +=1 00073 line.strip() 00074 path = Path( line.split(' ')[1:]) 00075 self.paths.append(path) 00076 caller = None 00077 for funcId in path.functionIds: 00078 func = self.idToFunctionInfo[funcId] 00079 if caller: 00080 func.addCaller(caller,path.count) 00081 caller.addCallee(func,path.count) 00082 caller = func 00083 feedbackIndex = 0 00084 if feedBackStream: 00085 feedBackStream.write('\nprocessing data:') 00086 for x in self.idToFunctionInfo.items(): 00087 if feedBackStream and (0 == feedbackIndex % 100): 00088 feedBackStream.write('.') 00089 feedbackIndex +=1 00090 x[1].normalize()
Definition at line 43 of file profilereader.py.
Definition at line 43 of file profilereader.py.
Definition at line 43 of file profilereader.py.