Skip to content

Commit

Permalink
Merge pull request #1366 from SeasideSt/gemstone-devtools
Browse files Browse the repository at this point in the history
added GemStone version of profiler tool and an objectsread tool
  • Loading branch information
jbrichau authored Jul 17, 2023
2 parents 22d3f96 + 5bc8bc5 commit d307075
Show file tree
Hide file tree
Showing 69 changed files with 409 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
processing
handleFiltered: aRequestContext
| size item |

item := WAObjectsReadItem request: aRequestContext request copy.
item start: DateAndTime now truncated.
System _enableTraceObjectsRead.
[ super handleFiltered: aRequestContext ]
ensure: [
size := System _disableTraceObjectsRead.
item
end: DateAndTime now truncated;
size: size;
objectsRead: (System _hiddenSetAsArray: 5).
items := items copyWith: item ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
items
^ items
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
processing
reset
items := Array new
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Seaside-GemStone-Development-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "JohanBrichau 06/07/2023 20:05",
"instvars" : [
"items" ],
"name" : "WAObjectsReadFilter",
"pools" : [
],
"super" : "WARequestFilter",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
request: aRequest
^ self basicNew initializeOn: aRequest; yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
end: aDateAndTime

end := aDateAndTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
end

^ end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initializeOn: aRequest
self initialize.
request := aRequest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
updating
objectsRead: newValue

"Modify the value of the instance variable 'objectsRead'."
objectsRead := newValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
objectsRead

"Return the value of the instance variable 'objectsRead'."
^objectsRead
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
as yet unclassified
report

| objects |

objects := (objectsRead groupBy:[:e | e class ] having:[:e | true ]) associations sorted:[:a :b | a value size > b value size ].
^ String streamContents:[:str |
objects do:[:assoc |
str
nextPutAll: assoc key name;
nextPutAll: '->';
nextPutAll: assoc value size asString;
cr ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
updating
request: newValue

"Modify the value of the instance variable 'request'."
request := newValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
request

"Return the value of the instance variable 'request'."
^request
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
updating
size: newValue

"Modify the value of the instance variable 'size'."
size := newValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
size

"Return the value of the instance variable 'size'."
^size
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
start: aDateAndTime

start := aDateAndTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
start

^ start
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"category" : "Seaside-GemStone-Development-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"request",
"objectsRead",
"size",
"start",
"end" ],
"name" : "WAObjectsReadItem",
"pools" : [
],
"super" : "WAObject",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
on: aCollection
^ self basicNew initializeOn: aCollection; yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
accessing
buildReport
^ WATableReport new
rows: self items;
columns: (OrderedCollection new
add: (WAReportColumn new
title: 'Start';
selector: #start;
cssClass: 'left';
yourself);
add: (WAReportColumn new
title: 'End';
selector: #end;
cssClass: 'left';
yourself);
add: (WAReportColumn new
title: 'Size';
selector: #size;
cssClass: 'left';
yourself);
add: (WAReportColumn new
title: 'Request';
valueBlock: [ :value | value request method , ' ' , value request url greaseString ];
clickBlock: [ :value | self show: (WAInspector current on: value request) ];
yourself);
add: (WAReportColumn new
sortBlock: nil;
title: 'Commands';
valueBlock: [ :value :html |
self
renderCommands: value
on: html ];
yourself);
yourself);
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initializeOn: aCollection
self initialize.
items := aCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
items
^ items
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
message
^message
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
renderCommands: anItem on: html
html anchor
callback: [ message := anItem report ];
with: 'Report'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
renderContentOn: html
html div class: 'tool'; with: self report.
self message isNil
ifFalse: [ html preformatted: self message ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
report
^ report ifNil: [ report := self buildReport ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"category" : "Seaside-GemStone-Development-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"report",
"items",
"message" ],
"name" : "WAObjectsReadTool",
"pools" : [
],
"super" : "WATool",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
actions
execute
self isProfiling
ifFalse: [ self session addFilter: self filter reset ]
ifTrue: [
self session removeFilter: self filter.
self open: (WAObjectsReadTool on: self filter items) ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
filter
^ filter ifNil: [ filter := WAObjectsReadFilter new ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
isProfiling
^ self session filters includes: self filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
label
^ self isProfiling
ifFalse: [ 'ObjectsRead' ]
ifTrue: [ 'Stop ObjectsRead' ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
priority
^ 450
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Seaside-GemStone-Development-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"filter" ],
"name" : "WAObjectsReadToolPlugin",
"pools" : [
],
"super" : "WAToolPlugin",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
processing
handleFiltered: aRequestContext
| item |
item := WAProfilerItem request: aRequestContext request copy.
[ item profile: [ super handleFiltered: aRequestContext ] ]
ensure: [ items := items copyWith: item ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
items
^ items
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
processing
reset
items := Array new
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Seaside-GemStone-Development-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"items" ],
"name" : "WAProfilerFilter",
"pools" : [
],
"super" : "WARequestFilter",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
request: aRequest
^ self basicNew initializeOn: aRequest; yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
duration
^ Duration seconds: (self end - self start)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
end
^ profmonitor endTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initializeOn: aRequest
self initialize.
request := aRequest
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public
profile: aBlock
profmonitor := ProfMonitor new.
profmonitor startMonitoring.
[ aBlock value ]
ensure: [ profmonitor stopMonitoring; gatherResults; removeFile. ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
report
^ profmonitor reportDownTo: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
request
"Answer the request causing this profile."

^ request
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
start
^ profmonitor startTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"category" : "Seaside-GemStone-Development-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"request",
"profmonitor" ],
"name" : "WAProfilerItem",
"pools" : [
],
"super" : "WAObject",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
on: aCollection
^ self basicNew initializeOn: aCollection; yourself
Loading

0 comments on commit d307075

Please sign in to comment.