Skip to content

Commit e368016

Browse files
authored
Merge pull request #101 from hpi-swa-lab/feature/flameGraph
Changes layout of Printbugger to resemble a flame graph
2 parents 2cd92f7 + b16737b commit e368016

27 files changed

+116
-139
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
private
22
filterableClassesInStack
3-
4-
^ {BlockClosure.
3+
4+
^ { BlockClosure.
55
Symbol.
66
DynamicVariable class.
77
CSProcessContextInformation.
88
CSMethodObject.
99
CSLayeredMethod.
1010
CSPartialMethod.
1111
TestCase.
12-
TestResult.}
12+
TestResult.
13+
BPPrintbuggerTest.
14+
}

packages/Babylonian-Core.package/BPTraceValue.class/instance/filterableMessagesInStack.st

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
private
22
filterableMessagesInStack
3-
3+
44
^ {MethodReference class: BlockClosure selector: #newProcess.
55
MethodReference class: BPExample selector: #traceInBackground.
66
MethodReference class: BlockClosure selector: #on:do:.
@@ -17,5 +17,4 @@ filterableMessagesInStack
1717
MethodReference class: BPMethodExample selector: #runOn:.
1818
MethodReference class: CSMethodObject selector: #run:with:in:.
1919
MethodReference class: CSLayeredMethod selector: #valueWithReceiver:arguments:.
20-
MethodReference class: CSPartialMethod selector: #valueWithReceiver:arguments:.
21-
MethodReference class: BlockClosure selector: #whileFalseDo:.}
20+
MethodReference class: CSPartialMethod selector: #valueWithReceiver:arguments:.}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
private
22
filteredStack
3-
4-
^ self filteredStackFor: self stack
3+
4+
^ self stack reject: [:aStackEntry | self shouldBeFiltered: aStackEntry ]
55

66

packages/Babylonian-Core.package/BPTraceValue.class/instance/filteredStackFor..st

-6
This file was deleted.

packages/Babylonian-Core.package/BPTraceValue.class/instance/oneSidedStackLevelTo..st

-14
This file was deleted.

packages/Babylonian-Core.package/BPTraceValue.class/instance/relativeStackLevelTo..st

-28
This file was deleted.

packages/Babylonian-Core.package/BPTraceValue.class/methodProperties.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
"chronologicalPosition" : "jb 5/20/2021 14:50",
1010
"chronologicalPosition:" : "jb 5/20/2021 14:50",
1111
"containedMethodReference" : "jb 7/2/2021 14:34",
12-
"filterableClassesInStack" : "jb 6/30/2021 00:58",
13-
"filterableMessagesInStack" : "jb 6/24/2021 22:43",
14-
"filteredStack" : "jb 6/30/2021 00:53",
15-
"filteredStackFor:" : "jb 6/30/2021 00:47",
12+
"filterableClassesInStack" : "jb 11/20/2021 02:07",
13+
"filterableMessagesInStack" : "jb 11/20/2021 01:52",
14+
"filteredStack" : "jb 11/19/2021 18:54",
1615
"isStackFull" : "jb 6/30/2021 01:26",
17-
"oneSidedStackLevelTo:" : "jb 8/1/2021 21:24",
1816
"printOn:" : "jb 5/19/2021 20:59",
19-
"relativeStackLevelTo:" : "jb 7/2/2021 14:36",
2017
"shouldBeFiltered:" : "jb 6/30/2021 00:55",
2118
"stack" : "pre 5/8/2019 18:36",
2219
"stack:" : "jb 12/7/2020 18:55",

packages/Babylonian-Printbugger.package/BPSwimlane.class/instance/barWidthFor.relativeTo..st

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
private
2+
colorFor: aMethodReference
3+
4+
^ context colorFor: aMethodReference having: self class barColorScheme
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
private
2-
lineSubmorphsFor: aTraceValue relativeTo: aStackRelation
3-
2+
lineSubmorphsFor: aTraceValue calledBy: aStackOfMethodReferences
3+
44
| valueMorph |
55
valueMorph := self newLabelValuePairMorphFor: aTraceValue.
66

77
^ {self newHaltButtonFor: aTraceValue.
88
self newBarMorphFor: aTraceValue
9-
relativeTo: aStackRelation
9+
calledBy: aStackOfMethodReferences
1010
withHeight: (valueMorph fullBounds height + 10).
1111
valueMorph.}
1212

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
private - ui
2+
newBarMorphFor: aTraceValue calledBy: aStackOfMethodReferences withHeight: aNumber
3+
4+
5+
^ Morph new
6+
name: #stackBar;
7+
color: Color transparent;
8+
changeTableLayout;
9+
listDirection: #rightToLeft;
10+
wrapCentering: #center;
11+
hResizing: #shrinkWrap;
12+
vResizing: #shrinkWrap;
13+
cellInset: 1@0;
14+
addAllMorphsBack: (aStackOfMethodReferences collect: [:aStackMethod |
15+
self newStackFrameMorphFor: aStackMethod withHeight: aNumber]);
16+
yourself

packages/Babylonian-Printbugger.package/BPSwimlane.class/instance/newBarMorphFor.relativeTo.withHeight..st

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
private - ui
2+
newStackFrameMorphFor: aMethodReference withHeight: aNumber
3+
4+
| stackMorph |
5+
stackMorph := Morph new
6+
color: (self colorFor: aMethodReference);
7+
extent: (self stackDepth@aNumber);
8+
balloonText: aMethodReference asString;
9+
setProperty: #stackMethodReference
10+
toValue: aMethodReference;
11+
on: #click
12+
send: #value
13+
to: [ToolSet browse: aMethodReference actualClass
14+
selector: aMethodReference selector];
15+
yourself.
16+
17+
stackMorph
18+
on: #mouseEnter
19+
send: #value
20+
to: [stackMorph borderStyle: (BorderStyle width: 2 color: Color black)];
21+
on: #mouseLeave
22+
send: #value
23+
to: [stackMorph borderStyle: nil].
24+
25+
^ stackMorph
26+
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
constants
22
stackDepth
3-
4-
^ self fontHeight
3+
4+
^ self fontHeight / 1.25

packages/Babylonian-Printbugger.package/BPSwimlane.class/instance/stackDepthsFor..st

-17
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
private
2+
stackMethodsFor: aBPExample
3+
4+
^ aBPExample traceValues collect: [:aTraceValue |
5+
aTraceValue filteredStack collect: [:aStackEntry | MethodReference class: aStackEntry fourth selector: aStackEntry third]]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
change notifications
22
updateLayoutToContext
3-
3+
44
self lineSubMorphs withIndexDo: [:aTraceValueLine :anIndex |
5-
(aTraceValueLine submorphNamed: #stackBar) color: (self colorFor: (example traceValues at: anIndex) in: context)].
5+
(aTraceValueLine submorphNamed: #stackBar) submorphsDo: [:aStackEntry |
6+
aStackEntry color: (self colorFor: (aStackEntry valueOfProperty: #stackMethodReference))]].
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
private
2-
visualizeLineFor: aTraceValue relativeTo: aStackRelation
3-
2+
visualizeLineFor: aTraceValue calledBy: aStackOfMethodReferences
3+
44
^ Morph new
55
name: aTraceValue chronologicalPosition asString;
66
color: Color transparent;
@@ -9,6 +9,6 @@ visualizeLineFor: aTraceValue relativeTo: aStackRelation
99
cellPositioning: #center;
1010
vResizing: #shrinkWrap;
1111
hResizing: #shrinkWrap;
12-
cellInset: 3@1;
13-
addAllMorphsBack: (self lineSubmorphsFor: aTraceValue relativeTo: aStackRelation);
14-
yourself.
12+
cellInset: 3@0;
13+
addAllMorphsBack: (self lineSubmorphsFor: aTraceValue calledBy: aStackOfMethodReferences);
14+
yourself
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
private
22
visualizeLinesFor: aBPExample
3-
4-
|stackDepthsRelativeToFirstLine|
5-
stackDepthsRelativeToFirstLine := self stackDepthsFor: aBPExample.
3+
4+
| stackMethods |
5+
stackMethods := self stackMethodsFor: aBPExample.
66

77
"Add a wrapper to have some distance between the title morph and the values"
88
^ Morph new
@@ -14,5 +14,5 @@ visualizeLinesFor: aBPExample
1414
wrapCentering: #center;
1515
cellPositioning: #topLeft;
1616
addAllMorphsBack: (aBPExample traceValues withIndexCollect: [:aTraceValue :anIndex |
17-
self visualizeLineFor: aTraceValue relativeTo: (stackDepthsRelativeToFirstLine at: anIndex )]);
17+
self visualizeLineFor: aTraceValue calledBy: (stackMethods at: anIndex )]);
1818
yourself

packages/Babylonian-Printbugger.package/BPSwimlane.class/methodProperties.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"newFor:" : "jb 6/10/2021 23:33",
66
"newFor:withContext:" : "jb 6/10/2021 23:24" },
77
"instance" : {
8-
"barWidthFor:relativeTo:" : "jb 6/25/2021 00:34",
8+
"colorFor:" : "jb 11/20/2021 01:29",
99
"colorFor:in:" : "jb 6/11/2021 01:04",
1010
"context:" : "jb 6/10/2021 23:26",
1111
"example:" : "jb 6/10/2021 15:06",
@@ -15,19 +15,20 @@
1515
"initialize" : "jb 6/10/2021 23:34",
1616
"initializeProperties" : "jb 7/10/2021 16:37",
1717
"lineSubMorphs" : "jb 7/10/2021 17:43",
18-
"lineSubmorphsFor:relativeTo:" : "jb 7/10/2021 16:57",
19-
"newBarMorphFor:relativeTo:withHeight:" : "jb 6/30/2021 03:10",
18+
"lineSubmorphsFor:calledBy:" : "jb 11/19/2021 21:37",
19+
"newBarMorphFor:calledBy:withHeight:" : "jb 11/19/2021 21:58",
2020
"newHaltButtonFor:" : "lu 6/17/2021 13:44",
2121
"newLabelFor:" : "jb 7/10/2021 17:13",
2222
"newLabelMorphFor:" : "jb 7/10/2021 17:14",
2323
"newLabelValuePairMorphFor:" : "jb 7/10/2021 17:14",
24+
"newStackFrameMorphFor:withHeight:" : "jb 11/20/2021 01:32",
2425
"newTitleMorphFor:" : "lu 7/20/2021 21:21",
2526
"positionInProbeFor:and:" : "jb 6/24/2021 22:21",
2627
"scrollBarSize" : "lu 6/9/2021 23:47",
27-
"stackDepth" : "jb 7/10/2021 16:50",
28-
"stackDepthsFor:" : "jb 6/30/2021 02:18",
28+
"stackDepth" : "jb 11/19/2021 18:29",
29+
"stackMethodsFor:" : "jb 11/19/2021 21:21",
2930
"update:with:" : "jb 7/1/2021 23:47",
30-
"updateLayoutToContext" : "jb 7/10/2021 17:43",
31+
"updateLayoutToContext" : "jb 11/20/2021 01:33",
3132
"visualize" : "jb 7/10/2021 16:41",
32-
"visualizeLineFor:relativeTo:" : "jb 7/10/2021 16:57",
33-
"visualizeLinesFor:" : "jb 7/10/2021 16:56" } }
33+
"visualizeLineFor:calledBy:" : "jb 11/19/2021 21:45",
34+
"visualizeLinesFor:" : "jb 11/19/2021 21:39" } }
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
tests
22
testSwimlaneDisplaysTraceValuesForOneProbe
3-
3+
44
| swimlane traceValues|
55
self initExample1WithMethodWithMultipleProbes.
66
swimlane := printbugger canvasMorph firstSubmorph.
77
self assert: (swimlane isKindOf: BPSwimlane).
88
self assert: 6 equals: (swimlane lineSubMorphs size).
9-
traceValues := swimlane allMorphs select: [:aSubmorph | aSubmorph isKindOf: StringMorph] thenCollect: [:aStringMorph | aStringMorph contents].
9+
traceValues := swimlane allMorphs select: [:aSubmorph |
10+
aSubmorph isKindOf: StringMorph] thenCollect: [:aStringMorph | aStringMorph contents].
1011
self assert: (traceValues includesAllOf: {'1'. '2'. '2'. '4'. '3'. '6'.}).
1112

packages/Babylonian-Tests.package/BPPrintbuggerTest.class/instance/testSwimlaneDisplaysTraceValuesForTwoProbesChronologicallySorted.st

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
tests
22
testSwimlaneDisplaysTraceValuesForTwoProbesChronologicallySorted
3-
3+
44
|swimlane traceValues traceIndexes|
55
self initExample1WithMethodWithMultipleProbes.
66
swimlane := BPSwimlane newFor: example1.
7-
traceValues := swimlane allMorphs select: [:aSubmorph | aSubmorph isKindOf: StringMorph] thenCollect: [:aStringMorph | aStringMorph contents].
7+
traceValues := swimlane allMorphs select: [:aSubmorph |
8+
aSubmorph isKindOf: StringMorph] thenCollect: [:aStringMorph | aStringMorph contents].
89
self assert: (traceValues includesAllOf: {'1'. '2'. '2'. '4'. '3'. '6'.}).
910
traceIndexes := {'1'. '2'. '2'. '4'. '3'. '6'.} collect: [:aTraceString | traceValues indexOf: aTraceString].
1011
self assert: traceIndexes isSorted.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
tests
22
testTwoTraceValuesInDifferentMethodsGetDifferentColorsInMultipleSwimlanes
3-
3+
44
|swimlane1 swimlane2 colors1 colors2|
55
self initExample1WithMethodWithMultipleProbes.
66
self initExample2WithSingleProbe.
77

88
swimlane1 := printbugger canvasMorph firstSubmorph.
99
swimlane2 := printbugger canvasMorph submorphs second.
10-
colors1 := (swimlane1 allMorphs select: [:aSubmorph | aSubmorph knownName = 'stackBar'] thenCollect: [:aBarMorph | aBarMorph color]) asSet.
11-
colors2 := (swimlane2 allMorphs select: [:aSubmorph | aSubmorph knownName = 'stackBar'] thenCollect: [:aBarMorph | aBarMorph color]) asSet.
10+
colors1 := (swimlane1 allMorphs select: [:aSubmorph |
11+
aSubmorph knownName = 'stackBar'] thenCollect: [:aBarMorph | aBarMorph firstSubmorph color]) asSet.
12+
colors2 := (swimlane2 allMorphs select: [:aSubmorph |
13+
aSubmorph knownName = 'stackBar'] thenCollect: [:aBarMorph | aBarMorph firstSubmorph color]) asSet.
1214

1315
self assert: colors1 size equals: colors2 size.
1416
self assert: colors1 ~= colors2.
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
tests
22
testTwoTraceValuesInDifferentMethodsGetDifferentColorsInSameSwimlane
3-
3+
44
|swimlane colors|
55
self initExample1WithMethodWithExampleCallingOnlyProbedMethod.
66

77
swimlane := printbugger canvasMorph firstSubmorph.
8-
colors := (swimlane allMorphs select: [:aSubmorph | aSubmorph knownName = 'stackBar'] thenCollect: [:aBarMorph | aBarMorph color]) asSet.
8+
colors := (swimlane allMorphs select: [:aSubmorph |
9+
aSubmorph knownName = 'stackBar'] thenCollect: [:aBarMorph | aBarMorph firstSubmorph color]) asSet.
910

1011
self assert: 2 equals: colors size.

0 commit comments

Comments
 (0)