-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
5a048f7
commit e112559
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
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,36 @@ | ||
Class { | ||
#name : 'IllPredictator', | ||
#superclass : 'Object', | ||
#instVars : [ | ||
'objectAllocations', | ||
'predictors' | ||
], | ||
#category : 'IllimaniProfiler-Analyzer', | ||
#package : 'IllimaniProfiler', | ||
#tag : 'Analyzer' | ||
} | ||
|
||
{ #category : 'as yet unclassified' } | ||
IllPredictator >> computePredictors [ | ||
|
||
predictors := Dictionary new. | ||
|
||
objectAllocations do: [ :illEphe | | ||
predictors | ||
at: illEphe allocationSite | ||
ifPresent: [ :predictor | | ||
predictor | ||
addLifetime: illEphe lifetime; | ||
addType: illEphe allocatedObjectClass ] | ||
ifAbsentPut: [ | ||
IllPredictor new | ||
allocationSite: illEphe allocationSite; | ||
addLifetime: illEphe lifetime; | ||
addType: illEphe allocatedObjectClass ] ] | ||
] | ||
|
||
{ #category : 'accessing' } | ||
IllPredictator >> objectAllocations: aCollection [ | ||
|
||
objectAllocations := aCollection | ||
] |
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,40 @@ | ||
Class { | ||
#name : 'IllPredictor', | ||
#superclass : 'Object', | ||
#instVars : [ | ||
'allocationSite', | ||
'lifetimes', | ||
'types' | ||
], | ||
#category : 'IllimaniProfiler-Analyzer', | ||
#package : 'IllimaniProfiler', | ||
#tag : 'Analyzer' | ||
} | ||
|
||
{ #category : 'adding' } | ||
IllPredictor >> addLifetime: anInteger [ | ||
|
||
| normalizedNumber | | ||
normalizedNumber := (anInteger log: 2) > 20 "because 2 ^ 20 is 1 MB" | ||
ifTrue: [ (anInteger log: 2) floor ] | ||
ifFalse: [ 0 ]. | ||
lifetimes add: normalizedNumber | ||
] | ||
|
||
{ #category : 'adding' } | ||
IllPredictor >> addType: aClass [ | ||
types add: aClass | ||
] | ||
|
||
{ #category : 'accessing' } | ||
IllPredictor >> allocationSite: anIllAllocationSite [ | ||
allocationSite := anIllAllocationSite | ||
] | ||
|
||
{ #category : 'initialization' } | ||
IllPredictor >> initialize [ | ||
|
||
super initialize. | ||
lifetimes := Bag new. | ||
types := Bag new | ||
] |