Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanmontt committed Jun 17, 2024
1 parent d25f63a commit 2226ae8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
12 changes: 7 additions & 5 deletions src/IllimaniProfiler-Tests/IllAbstractProfilerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,21 @@ IllAbstractProfilerTest >> testProfileOnSimple [
{ #category : 'tests' }
IllAbstractProfilerTest >> testSamplingRate [

| allocatedByteSrings |
| allocatedObjects profilerAllocations |

"The profiler makes some allocations when being installed."
profilerAllocations := 11.

profiler
samplingRate: 33 / 100;
profileOn: [ 100 timesRepeat: [ ByteString new ] ].
profileOn: [ 100 timesRepeat: [ Object new ] ].

allocatedByteSrings := (profiler objectAllocations select:
[ :e | e allocatedObjectClass = ByteString ]) size.
allocatedObjects := profiler objectAllocations size - profilerAllocations.

"We are cheking in this range becase the profiler makes some allocations that are
necessary for the profiler to work, like Durations objects. So we cannot check that the
allocations are exacty 1/3 of the total."
self assert: (allocatedByteSrings >= 33) & (allocatedByteSrings < 40)
self assert: (allocatedObjects between: 30 and: 33)
]

{ #category : 'tests' }
Expand Down
18 changes: 0 additions & 18 deletions src/IllimaniProfiler-Tests/IllAllocationRateProfilerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,6 @@ IllAllocationRateProfilerTest >> profilerClass [
^ IllAllocationRateProfiler
]

{ #category : 'tests' }
IllAllocationRateProfilerTest >> testSamplingRate [

| allocatedObjects |

profiler
samplingRate: 33 / 100;
profileOn: [ 100 timesRepeat: [ Object new ] ].

"We don't have the classes on this profiler"
allocatedObjects := profiler objectAllocations size.

"We are cheking in this range becase the profiler makes some allocations that are
necessary for the profiler to work, like Durations objects. So we cannot check that the
allocations are exacty 1/3 of the total."
self assert: (allocatedObjects >= 33) & (allocatedObjects < 40)
]

{ #category : 'tests' }
IllAllocationRateProfilerTest >> testSamplingRate1in1000 [

Expand Down

0 comments on commit 2226ae8

Please sign in to comment.