8000 Add an explicit threshold object · feenkcom/gt4pharo@466e3db · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 466e3db

Browse files
committed
Add an explicit threshold object
1 parent 7665181 commit 466e3db

3 files changed

+74
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Class {
2+
#name : #GtVmMemoryConfigurationBytesMemoryThreshold,
3+
#superclass : #GtVmMemoryConfigurationDataThreshold,
4+
#category : #'GToolkit-Pharo-System'
5+
}
6+
7+
{ #category : #comparison }
8+
GtVmMemoryConfigurationBytesMemoryThreshold >> = anObject [
9+
]
10+
11+
{ #category : #printing }
12+
GtVmMemoryConfigurationBytesMemoryThreshold >> description [
13+
^ String streamContents: [ :aStream |
14+
self descriptionOn: aStream ]
15+
]
16+
17+
{ #category : #printing }
18+
GtVmMemoryConfigurationBytesMemoryThreshold >> descriptionOn: aStream [
19+
thresholdValue
20+
ifNotNil: [aStream nextPutAll: thresholdValue humanReadableIsqByteSize]
21+
]
22+
23+
{ #category : #printing }
24+
GtVmMemoryConfigurationBytesMemoryThreshold >> printOn: aStream [
25+
super printOn: aStream.
26+
27+
aStream parenthesize: [
28+
self descriptionOn: aStream ]
29+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Class {
2+
#name : #GtVmMemoryConfigurationDataThreshold,
3+
#superclass : #Object,
4+
#instVars : [
5+
'thresholdValue'
6+
],
7+
#category : #'GToolkit-Pharo-System'
8+
}
9+
10+
{ #category : #comparison }
11+
GtVmMemoryConfigurationDataThreshold >> = anObject [
12+
self == anObject ifTrue: [ ^ true ].
13+
self class = anObject class ifFalse: [ ^ false ].
14+
15+
^ self thresholdValue = anObject thresholdValue
16+
]
17+
18+
{ #category : #accessing }
19+
GtVmMemoryConfigurationDataThreshold >> thresholdValue [
20+
^thresholdValue
21+
]
22+
23+
{ #category : #accessing }
24+
GtVmMemoryConfigurationDataThreshold >> thresholdValue: anObject [
25+
thresholdValue := anObject
26+
]

src/GToolkit-Pharo-System/GtVmMemoryConfigurationInstaller.class.st

+19-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ GtVmMemoryConfigurationInstaller >> applyWithId: aMemoryConfigurationId during:
8080
GtVmMemoryConfigurationInstaller >> dataThresholdAt: aString above: aValue [
8181
^ self
8282
dataThresholdAt: aString
83-
ifPresent: [ :each | aValue > each ]
83+
ifPresent: [ :each | aValue > each thresholdValue ]
8484
ifAbsent: [ false ]
8585
]
8686

@@ -118,6 +118,20 @@ GtVmMemoryConfigurationInstaller >> gtConfigurationBuildersFor: aView [
118118
view: #gtConfigurationsBuildersByIdFor:
119119
]
120120

121+
{ #category : #views }
122+
GtVmMemoryConfigurationInstaller >> gtDataThresholdsFor: aView [
123+
<gtView>
124+
125+
^aView columnedList
126+
title: 'Data Thresholds';
127+
priority: 1;
128+
items: [ dataThresholds associations ];
129+
column: 'Key' text: [ :assoc | assoc key ];
130+
column: 'Value' text: [ :assoc | assoc value description ] weight: 3;
131+
send: [ :assoc | assoc value ].
132+
133+
]
134+
121135
{ #category : #initialization }
122136
GtVmMemoryConfigurationInstaller >> initialize [
123137
super initialize.
@@ -126,7 +140,10 @@ GtVmMemoryConfigurationInstaller >> initialize [
126140
configurationsRegistry := GtVmMemoryConfigurationRegistry new.
127141
dataThresholds := Dictionary new.
128142

129-
self dataThresholdAt: #epiceaMethodSourcesSize put: 5* 1024 * 1024 "5 MiB"
143+
self
144+
dataThresholdAt: #epiceaMethodSourcesSize
145+
put: (GtVmMemoryConfigurationBytesMemoryThreshold new
146+
thresholdValue: 5* 1024 * 1024) "5 MiB"
130147
]
131148

132149
{ #category : #testing }

0 commit comments

Comments
 (0)
0