-
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.
Added tables in the ui to show the gc survived cycles
- Loading branch information
1 parent
46cc1e4
commit ff8eb76
Showing
6 changed files
with
164 additions
and
61 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
79 changes: 79 additions & 0 deletions
79
src/IllimaniUI/AllocationsGroupedByTablePresenter.class.st
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,79 @@ | ||
Class { | ||
#name : 'AllocationsGroupedByTablePresenter', | ||
#superclass : 'SpPresenter', | ||
#instVars : [ | ||
'tablePresenter', | ||
'totalMemory', | ||
'totalAllocations', | ||
'groupedAllocations' | ||
], | ||
#category : 'IllimaniUI-Widgets', | ||
#package : 'IllimaniUI', | ||
#tag : 'Widgets' | ||
} | ||
|
||
{ #category : 'initialization' } | ||
AllocationsGroupedByTablePresenter >> connectPresenters [ | ||
|
||
tablePresenter whenSelectedDo: [ :item | item value inspect ] | ||
] | ||
|
||
{ #category : 'initialization' } | ||
AllocationsGroupedByTablePresenter >> convertToPercentageString: aNumber [ | ||
|
||
^ (aNumber * 100 printShowingDecimalPlaces: 2) , '%' | ||
] | ||
|
||
{ #category : 'layout' } | ||
AllocationsGroupedByTablePresenter >> defaultLayout [ | ||
|
||
^ SpBoxLayout newTopToBottom | ||
add: tablePresenter; | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing - model' } | ||
AllocationsGroupedByTablePresenter >> groupAllocations: someObjectAllocations [ | ||
|
||
^ self subclassResponsibility | ||
] | ||
|
||
{ #category : 'initialization' } | ||
AllocationsGroupedByTablePresenter >> initializePresenters [ | ||
|
||
tablePresenter := self newTable | ||
activateOnSingleClick; | ||
items: groupedAllocations; | ||
alternateRowsColor; | ||
addColumn: (SpStringTableColumn | ||
title: self titleForGroupingColumn | ||
evaluated: [ :assoc | assoc key ]); | ||
addColumn: (SpStringTableColumn | ||
title: 'Total allocated memory' | ||
evaluated: [ :assoc | (assoc value sum: [ :e | e sizeInBytes ]) humanReadableByteSizeString ]); | ||
addColumn: (SpStringTableColumn | ||
title: '% Memory' | ||
evaluated: [ :assoc | self convertToPercentageString: (assoc value sum: [ :e | e sizeInBytes ]) / totalMemory ]); | ||
addColumn: (SpStringTableColumn | ||
title: '# of allocated objects' | ||
evaluated: [ :assoc | assoc value size asStringWithCommas ]); | ||
addColumn: (SpStringTableColumn | ||
title: '% Allocated objects' | ||
evaluated: [ :assoc | self convertToPercentageString: (assoc value size / totalAllocations) ]); | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing - model' } | ||
AllocationsGroupedByTablePresenter >> setModelBeforeInitialization: someObjectAllocations [ | ||
|
||
groupedAllocations := self groupAllocations: someObjectAllocations. | ||
groupedAllocations sort: [ :a :b | a key < b key ]. | ||
totalMemory := groupedAllocations sum: [ :assoc | assoc value sum: [ :e | e sizeInBytes ] ]. | ||
totalAllocations := groupedAllocations sum: [ :assoc | assoc value size ]. | ||
] | ||
|
||
{ #category : 'initialization' } | ||
AllocationsGroupedByTablePresenter >> titleForGroupingColumn [ | ||
|
||
^ self subclassResponsibility | ||
] |
20 changes: 20 additions & 0 deletions
20
src/IllimaniUI/FinalizationFullGCCyclesTablePresenter.class.st
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,20 @@ | ||
Class { | ||
#name : 'FinalizationFullGCCyclesTablePresenter', | ||
#superclass : 'AllocationsGroupedByTablePresenter', | ||
#category : 'IllimaniUI-Widgets', | ||
#package : 'IllimaniUI', | ||
#tag : 'Widgets' | ||
} | ||
|
||
{ #category : 'accessing - model' } | ||
FinalizationFullGCCyclesTablePresenter >> groupAllocations: someObjectAllocations [ | ||
|
||
^ (someObjectAllocations groupedBy: [ :allocationModel | | ||
allocationModel survivedFullGC ]) associations | ||
] | ||
|
||
{ #category : 'initialization' } | ||
FinalizationFullGCCyclesTablePresenter >> titleForGroupingColumn [ | ||
|
||
^ '# of full GCs survived' | ||
] |
62 changes: 7 additions & 55 deletions
62
src/IllimaniUI/FinalizationLifetimesTablePresenter.class.st
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 |
---|---|---|
@@ -1,68 +1,20 @@ | ||
Class { | ||
#name : 'FinalizationLifetimesTablePresenter', | ||
#superclass : 'SpPresenter', | ||
#instVars : [ | ||
'tablePresenter', | ||
'groupedAllocationsBySeconds', | ||
'totalMemory', | ||
'totalAllocations' | ||
], | ||
#superclass : 'AllocationsGroupedByTablePresenter', | ||
#category : 'IllimaniUI-Widgets', | ||
#package : 'IllimaniUI', | ||
#tag : 'Widgets' | ||
} | ||
|
||
{ #category : 'initialization' } | ||
FinalizationLifetimesTablePresenter >> connectPresenters [ | ||
|
||
tablePresenter whenSelectedDo: [ :item | item value inspect ] | ||
] | ||
|
||
{ #category : 'initialization' } | ||
FinalizationLifetimesTablePresenter >> convertToPercentageString: aNumber [ | ||
|
||
^ (aNumber * 100 printShowingDecimalPlaces: 2) , '%' | ||
] | ||
|
||
{ #category : 'layout' } | ||
FinalizationLifetimesTablePresenter >> defaultLayout [ | ||
{ #category : 'accessing - model' } | ||
FinalizationLifetimesTablePresenter >> groupAllocations: someObjectAllocations [ | ||
|
||
^ SpBoxLayout newTopToBottom | ||
add: tablePresenter; | ||
yourself | ||
^ (someObjectAllocations groupedBy: [ :allocationModel | | ||
allocationModel lifetimeAsDuration asSeconds ]) associations | ||
] | ||
|
||
{ #category : 'initialization' } | ||
FinalizationLifetimesTablePresenter >> initializePresenters [ | ||
|
||
tablePresenter := self newTable | ||
activateOnSingleClick; | ||
items: groupedAllocationsBySeconds; | ||
alternateRowsColor; | ||
addColumn: (SpStringTableColumn | ||
title: 'Lifetime duration (seconds)' | ||
evaluated: [ :assoc | assoc key ]); | ||
addColumn: (SpStringTableColumn | ||
title: 'Total allocated memory' | ||
evaluated: [ :assoc | (assoc value sum: [ :e | e sizeInBytes ]) humanReadableByteSizeString ]); | ||
addColumn: (SpStringTableColumn | ||
title: '% Memory' | ||
evaluated: [ :assoc | self convertToPercentageString: (assoc value sum: [ :e | e sizeInBytes ]) / totalMemory ]); | ||
addColumn: (SpStringTableColumn | ||
title: '# of allocated objects' | ||
evaluated: [ :assoc | assoc value size asStringWithCommas ]); | ||
addColumn: (SpStringTableColumn | ||
title: '% Allocated objects' | ||
evaluated: [ :assoc | self convertToPercentageString: (assoc value size / totalAllocations) ]); | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing - model' } | ||
FinalizationLifetimesTablePresenter >> setModelBeforeInitialization: someObjectAllocations [ | ||
FinalizationLifetimesTablePresenter >> titleForGroupingColumn [ | ||
|
||
groupedAllocationsBySeconds := (someObjectAllocations groupedBy: [ :allocationModel | | ||
allocationModel lifetimeAsDuration asSeconds ]) associations. | ||
groupedAllocationsBySeconds sort: [ :a :b | a key < b key ]. | ||
totalMemory := groupedAllocationsBySeconds sum: [ :assoc | assoc value sum: [ :e | e sizeInBytes ] ]. | ||
totalAllocations := groupedAllocationsBySeconds sum: [ :assoc | assoc value size ]. | ||
^ 'Lifetime duration (seconds)' | ||
] |
20 changes: 20 additions & 0 deletions
20
src/IllimaniUI/FinalizationScavengesCyclesTablePresenter.class.st
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,20 @@ | ||
Class { | ||
#name : 'FinalizationScavengesCyclesTablePresenter', | ||
#superclass : 'AllocationsGroupedByTablePresenter', | ||
#category : 'IllimaniUI-Widgets', | ||
#package : 'IllimaniUI', | ||
#tag : 'Widgets' | ||
} | ||
|
||
{ #category : 'accessing - model' } | ||
FinalizationScavengesCyclesTablePresenter >> groupAllocations: someObjectAllocations [ | ||
|
||
^ (someObjectAllocations groupedBy: [ :allocationModel | | ||
allocationModel survivedScavenges ]) associations | ||
] | ||
|
||
{ #category : 'initialization' } | ||
FinalizationScavengesCyclesTablePresenter >> titleForGroupingColumn [ | ||
|
||
^ '# of scavenges survived' | ||
] |
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