Skip to content

Commit

Permalink
Got some additional speed-up with inlining fqn
Browse files Browse the repository at this point in the history
  • Loading branch information
holzkohlengrill committed Oct 23, 2019
1 parent 2e556e8 commit f9a023d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions Emma/emma_libs/memoryEntry.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def getFQN(self, sep="::"):
:param sep: [string]="::" separator in FQN
:return: [string] FQN
"""
# This is used inline in memoryMap.py::resolveDuplicateContainmentOverlap()
return f"{self.configID}{sep}{self.mapfile}{sep}{self.sectionName}{sep}{self.objectName}" if self.objectName != "" and self.objectName != OBJECTS_IN_SECTIONS_SECTION_ENTRY and self.objectName != OBJECTS_IN_SECTIONS_SECTION_RESERVE else f"{self.configID}{sep}{self.mapfile}{sep}{self.sectionName}"


Expand Down
13 changes: 6 additions & 7 deletions Emma/emma_libs/memoryMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def resolveDuplicateContainmentOverlap(consumerCollection, memEntryHandler):
if actualElement.addressStart == otherElement.addressStart and actualElement.addressLength == otherElement.addressLength:
# Setting the actualElement´s duplicateFlag if it was not already set
if actualElement.duplicateFlag is None:
actualElement.duplicateFlag = otherElement.getFQN()
# Inlining .getFQN() brings additional speed-up
actualElement.duplicateFlag = f"{otherElement.configID}::{otherElement.mapfile}::{otherElement.sectionName}::{otherElement.objectName}" if otherElement.objectName != "" and otherElement.objectName != OBJECTS_IN_SECTIONS_SECTION_ENTRY and otherElement.objectName != OBJECTS_IN_SECTIONS_SECTION_RESERVE else f"{otherElement.configID}::{otherElement.mapfile}::{otherElement.sectionName}"
# Setting the actualElement to zero addressLength if this was not the first element of the duplicates
# This is needed to include only one of the duplicate elements with the real size in the report and not to distort the results
if otherElement.duplicateFlag is not None:
Expand All @@ -79,7 +80,8 @@ def resolveDuplicateContainmentOverlap(consumerCollection, memEntryHandler):
if actualElement.addressStart >= otherElement.addressStart and (actualElement.addressStart + actualElement.addressLength) <= (otherElement.addressStart + otherElement.addressLength):
# Setting the actualElement´s containmentFlag if it was not already set
if actualElement.containmentFlag is None:
actualElement.containmentFlag = otherElement.getFQN()
# Inlining .getFQN() brings additional speed-up
actualElement.containmentFlag = f"{otherElement.configID}::{otherElement.mapfile}::{otherElement.sectionName}::{otherElement.objectName}" if otherElement.objectName != "" and otherElement.objectName != OBJECTS_IN_SECTIONS_SECTION_ENTRY and otherElement.objectName != OBJECTS_IN_SECTIONS_SECTION_RESERVE else f"{otherElement.configID}::{otherElement.mapfile}::{otherElement.sectionName}"
# Setting the actualElement to zero addressLength because this was contained by the otherElement
# This is needed to include only one of these elements with the real size in the report and not to distort the results
actualElement.addressLength = 0
Expand All @@ -90,7 +92,8 @@ def resolveDuplicateContainmentOverlap(consumerCollection, memEntryHandler):
else:
# Case 5: actualElement is overlapped by otherElement: otherElement starts before and ends inside actualElement
if actualElement.addressStart > otherElement.addressStart and (actualElement.addressStart + actualElement.addressLength) > (otherElement.addressStart + otherElement.addressLength):
actualElement.overlapFlag = otherElement.getFQN()
# Inlining .getFQN() brings additional speed-up
actualElement.overlapFlag = f"{otherElement.configID}::{otherElement.mapfile}::{otherElement.sectionName}::{otherElement.objectName}" if otherElement.objectName != "" and otherElement.objectName != OBJECTS_IN_SECTIONS_SECTION_ENTRY and otherElement.objectName != OBJECTS_IN_SECTIONS_SECTION_RESERVE else f"{otherElement.configID}::{otherElement.mapfile}::{otherElement.sectionName}"
# Adjusting the addresses and length of the actualElement: reducing its size by the overlapping part
newAddressStart = otherElement.addressStart + otherElement.addressLength
sizeOfOverlappingPart = newAddressStart - actualElement.addressStart
Expand All @@ -99,10 +102,6 @@ def resolveDuplicateContainmentOverlap(consumerCollection, memEntryHandler):
# Case X: SW error, unhandled case...
else:
sc().error("MemoryManager::resolveOverlap(): Case X: SW error, unhandled case...")
# Clean-up temp members
# consumerCollection = list(map(lambda: del )
# blah
# consumerCollection = [del(element.FQE) for element in consumerCollection]


def calculateObjectsInSections(sectionContainer, objectContainer):
Expand Down

0 comments on commit f9a023d

Please sign in to comment.