Bug 918581 - Extend merge-profile.py to support secondary threads. r=vlad

--HG--
extra : rebase_source : 28357bbb17b15c7cb40c53ee3442bc6366fcf015
This commit is contained in:
Benoit Girard 2013-09-19 23:24:07 -04:00
Родитель 7afa961994
Коммит 906e0daa78
1 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -36,27 +36,27 @@ def MergeProfiles(files):
minStartTime = min(minStartTime, fileData['profileJSON']['meta']['startTime']) minStartTime = min(minStartTime, fileData['profileJSON']['meta']['startTime'])
meta['startTime'] = minStartTime meta['startTime'] = minStartTime
thread = fileData['profileJSON']['threads'][0] for thread in fileData['profileJSON']['threads']:
thread['name'] = pname + " (" + pid + ")" thread['name'] = thread['name'] + " (" + pname + ":" + pid + ")"
threads.append(thread) threads.append(thread)
# Note that pid + sym, pid + location could be ambigious # Note that pid + sym, pid + location could be ambigious
# if we had pid=11 sym=1 && pid=1 sym=11. To avoid this we format # if we had pid=11 sym=1 && pid=1 sym=11. To avoid this we format
# pidStr with leading zeros. # pidStr with leading zeros.
pidStr = "%05d" % (int(pid)) pidStr = "%05d" % (int(pid))
thread['startTime'] = fileData['profileJSON']['meta']['startTime'] thread['startTime'] = fileData['profileJSON']['meta']['startTime']
samples = thread['samples'] samples = thread['samples']
for sample in thread['samples']: for sample in thread['samples']:
for frame in sample['frames']: for frame in sample['frames']:
if "location" in frame and frame['location'][0:2] == '0x': if "location" in frame and frame['location'][0:2] == '0x':
frame['location'] = pidStr + frame['location'] frame['location'] = pidStr + frame['location']
filesyms = fileData['symbolicationTable'] filesyms = fileData['symbolicationTable']
for sym in filesyms.keys(): for sym in filesyms.keys():
symTable[pidStr + sym] = filesyms[sym] symTable[pidStr + sym] = filesyms[sym]
# For each process, make the time offsets line up based on the # For each thread, make the time offsets line up based on the
# earliest start # earliest start
for thread in threads: for thread in threads:
delta = thread['startTime'] - minStartTime delta = thread['startTime'] - minStartTime