Skip to content

Commit

Permalink
Refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanmontt committed Feb 20, 2024
1 parent 4ffe1bc commit 32fa768
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 172 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
Class {
#name : 'IllAllocationProfilerTest',
#name : 'IllAllocationSiteProfilerTest',
#superclass : 'IllAbstractProfilerTest',
#category : 'IllimaniProfiler-Tests-Allocations-Profiler',
#package : 'IllimaniProfiler-Tests',
#tag : 'Allocations-Profiler'
}

{ #category : 'running' }
IllAllocationProfilerTest >> profilerClass [
IllAllocationSiteProfilerTest >> profilerClass [

^ IllAllocationProfiler
^ IllAllocationSiteProfiler
]

{ #category : 'tests' }
IllAllocationProfilerTest >> testProfileOnCopyExecutionStack [
IllAllocationSiteProfilerTest >> testProfileOnCopyExecutionStack [

profiler
copyExecutionStack;
profileOn: [ 10 timesRepeat: [ IllAllocationProfiler new ] ].
profileOn: [ 10 timesRepeat: [ IllAllocationSiteProfiler new ] ].

"Take one random allocation to check"
self assert: profiler objectAllocations last context class equals: Context.
Expand All @@ -28,7 +28,7 @@ IllAllocationProfilerTest >> testProfileOnCopyExecutionStack [
]

{ #category : 'tests' }
IllAllocationProfilerTest >> testProfileOnSimpleMoreAllocations [
IllAllocationSiteProfilerTest >> testProfileOnSimpleMoreAllocations [

profiler profileOn: [ 1000 timesRepeat: [ self profilerClass new ] ].

Expand Down
60 changes: 0 additions & 60 deletions src/IllimaniProfiler/AllocationBasicInfoModel.class.st

This file was deleted.

79 changes: 0 additions & 79 deletions src/IllimaniProfiler/AllocationFinalizationInfoModel.class.st

This file was deleted.

75 changes: 71 additions & 4 deletions src/IllimaniProfiler/AllocationSiteInfoModel.class.st
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
Class {
#name : 'AllocationSiteInfoModel',
#superclass : 'AllocationFinalizationInfoModel',
#superclass : 'Object',
#instVars : [
'allocatedObjectClass',
'sizeInBytes',
'context',
'allocatorMethod',
'allocatorClass',
'contextFingerprint'
'contextFingerprint',
'initializationTime'
],
#category : 'IllimaniProfiler-Model-Allocation',
#category : 'IllimaniProfiler-Allocation-Profiler',
#package : 'IllimaniProfiler',
#tag : 'Model-Allocation'
#tag : 'Allocation-Profiler'
}

{ #category : 'accessing' }
AllocationSiteInfoModel >> allocatedObjectClass [

^ allocatedObjectClass
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> allocatedObjectClass: anObject [

allocatedObjectClass := anObject
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> allocatorClass [

Expand Down Expand Up @@ -77,15 +92,48 @@ AllocationSiteInfoModel >> fullMethodName [
^ allocatorMethod name
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> initializationTime [
"In microseconds"

^ initializationTime
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> initializationTime: microsecondsAsInt [
"In microseconds"

initializationTime := microsecondsAsInt
]

{ #category : 'inspector - extensions' }
AllocationSiteInfoModel >> inspectableAssociations [

^ super inspectableAssociations , {
('Allocated Object Class' -> allocatedObjectClass).
('Memory Size' -> sizeInBytes humanReadableByteSizeString).
('Initialization timestamp' -> initializationTime).
('Allocator Class' -> allocatorClass).
('Allocator Method' -> allocatorMethod).
('Context' -> context) }
]

{ #category : 'inspector - extensions' }
AllocationSiteInfoModel >> inspectorExtension: aBuilder [

<inspectorPresentationOrder: 0 title: 'Overview'>
| tablePresenter elements items |
elements := self inspectableAssociations.
items := elements collect: [ :e | StInspectorAssociationNode hostObject: e ].
tablePresenter := aBuilder newTable.
tablePresenter
addColumn: (SpStringTableColumn title: 'Name' evaluated: #key);
addColumn: (SpStringTableColumn title: 'Value' evaluated: #value);
items: items;
beResizable.
^ tablePresenter
]

{ #category : 'inspector - extensions' }
AllocationSiteInfoModel >> inspectorExtensionContextFingerprint: aBuilder [

Expand All @@ -101,3 +149,22 @@ AllocationSiteInfoModel >> printOn: aStream [
sizeInBytes ifNil: [ aStream << ' - ' ]
ifNotNil: [ aStream << sizeInBytes humanReadableByteSizeString ]
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> sizeInBytes [
"Returns the size in memory in bytes"

^ sizeInBytes
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> sizeInBytes: aNumber [

sizeInBytes := aNumber
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> timeAsSeconds [

^ initializationTime / 1000000
]
4 changes: 2 additions & 2 deletions src/IllimaniProfiler/GCActivityMonitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Class {
'waitingTime',
'scavenges'
],
#category : 'IllimaniProfiler-Model-Statistics',
#category : 'IllimaniProfiler-GC-Monitor',
#package : 'IllimaniProfiler',
#tag : 'Model-Statistics'
#tag : 'GC-Monitor'
}

{ #category : 'exporting' }
Expand Down
Loading

0 comments on commit 32fa768

Please sign in to comment.