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