Skip to content

Commit

Permalink
context fingerprint
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanmontt committed Feb 2, 2024
1 parent d9214ce commit 9b18da0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions src/IllimaniProfiler/AllocationSiteInfoModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Class {
#instVars : [
'context',
'allocatorMethod',
'allocatorClass'
'allocatorClass',
'contextFingerprint'
],
#category : 'IllimaniProfiler-Model-Allocation',
#package : 'IllimaniProfiler',
Expand Down Expand Up @@ -50,7 +51,13 @@ AllocationSiteInfoModel >> context: anObject [
{ #category : 'accessing' }
AllocationSiteInfoModel >> contextFingerprint [

^ ''
^ contextFingerprint
]

{ #category : 'accessing' }
AllocationSiteInfoModel >> contextFingerprint: aContext [

contextFingerprint := self getContextFingerprint: aContext
]

{ #category : 'accessing' }
Expand All @@ -60,18 +67,9 @@ AllocationSiteInfoModel >> fullMethodName [
]

{ #category : 'initialization' }
AllocationSiteInfoModel >> getContextFingerprintStream: aContext [

self flag: 'This is the first "naive" implementation of the context fingerprint. It breaks in Pharo 12'.

^ String streamContents: [ :stream |
| iterator |
iterator := aContext.
1 to: 10 do: [ :index |
iterator printOn: stream.
stream << String cr.
iterator := iterator sender.
iterator ifNil: [ ^ stream ] ] ]
AllocationSiteInfoModel >> getContextFingerprint: aContext [

^ "String streamContents: [ :stream | aContext debugStack: 2 on: stream ]" aContext asString
]

{ #category : 'inspector - extensions' }
Expand Down
2 changes: 1 addition & 1 deletion src/IllimaniProfiler/IllAllocationProfiler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ IllAllocationProfiler >> internalRegisterAllocation: newlyAllocatedObject [
allocatorClass: filteredContext receiver class;
allocatorMethod: filteredContext compiledCode method;
allocatedObjectClass: newlyAllocatedObject class;
"contextFingerprint: filteredContext;"
contextFingerprint: filteredContext;
sizeInBytes: newlyAllocatedObject sizeInMemory;
initializationTime: Time primUTCMicrosecondsClock.

Expand Down

0 comments on commit 9b18da0

Please sign in to comment.