in heats.py [0:0]
def get_guide_info(damon_result):
"return the set of guide information for the moitoring result"
guides = {}
for snapshots in damon_result.target_snapshots.values():
for snapshot in snapshots:
monitor_time = snapshot.end_time
tid = snapshot.target_id
if not tid in guides:
guides[tid] = GuideInfo(tid, monitor_time)
guide = guides[tid]
guide.end_time = monitor_time
last_addr = None
gaps = []
for r in snapshot.regions:
saddr = r.start
eaddr = r.end
if not guide.lowest_addr or saddr < guide.lowest_addr:
guide.lowest_addr = saddr
if not guide.highest_addr or eaddr > guide.highest_addr:
guide.highest_addr = eaddr
if not last_addr:
last_addr = eaddr
continue
if last_addr != saddr:
gaps.append([last_addr, saddr])
last_addr = eaddr
if not guide.gaps:
guide.gaps = gaps
else:
guide.gaps = overlapping_regions(guide.gaps, gaps)
return sorted(list(guides.values()), key=lambda x: x.total_space(),
reverse=True)