Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
186 additions
and
67 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
shark/shark/src/main/java/shark/AndroidObjectSizeCalculator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package shark | ||
|
||
import shark.DominatorTree.ObjectSizeCalculator | ||
import shark.internal.ShallowSizeCalculator | ||
|
||
class AndroidObjectSizeCalculator(graph: HeapGraph) : ObjectSizeCalculator { | ||
|
||
private val nativeSizes = AndroidNativeSizeMapper(graph).mapNativeSizes() | ||
private val shallowSizeCalculator = ShallowSizeCalculator(graph) | ||
|
||
override fun computeSize(objectId: Long): Int { | ||
val nativeSize = nativeSizes[objectId] ?: 0 | ||
val shallowSize = shallowSizeCalculator.computeShallowSize(objectId) | ||
return nativeSize + shallowSize | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.