-
Notifications
You must be signed in to change notification settings - Fork 65
/
VMMcpcBcpcMap.class.st
50 lines (43 loc) · 1.1 KB
/
VMMcpcBcpcMap.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"
My instances represent the mapping between mcpc (machine code program counter) to bcpc (bytecode program counter) for a given compiled code.
map is an orderedCollection, each element being an association, the key being the range in the bytecode, the value the number of samples within that range.
"
Class {
#name : #VMMcpcBcpcMap,
#superclass : #Object,
#instVars : [
'map'
],
#category : #'CogTools-VMProfiler'
}
{ #category : #accessing }
VMMcpcBcpcMap >> addRange: range numSamples: numSamples [
map add: (range key + 1 -> (range value + 1)) -> numSamples
]
{ #category : #iterating }
VMMcpcBcpcMap >> bcRangeAndNumSamplesDo: binaryBlock [
map do: [ :assoc |
binaryBlock
value: assoc key
value: assoc value ]
]
{ #category : #initialization }
VMMcpcBcpcMap >> initialize [
super initialize.
map := OrderedCollection new.
]
{ #category : #printing }
VMMcpcBcpcMap >> printOn: s [
s << 'McpcBcpcMap ('.
map do:
[ :assoc |
s
<< '['
<< assoc key key printString
<< ';'
<< assoc key value printString
<< ']>'
<< assoc value printString
<< ' ' ].
s << ')'
]