Profiling the user interface for a method styling

One way to profile computations in Glamorous Toolkit is to do it from the point of view of the user interface. This is what GtProfiler BrPager subclass: #GtProfiler instanceVariableNames: 'openedSpaces framesChart layersGraph' classVariableNames: '' package: 'GToolkit-Profiler' offers.

You can open the profiler with:

GtProfiler open
  

The profiler offers the other windows to choose from as target for profiling. It is necessary to open a new window with this profiler to avoid profiling the profiler.

For example, browse BlElement>>#addChild:at: addChild: anElement at: anIndex "Add anElement at an index moving other children to the right. anElement must not be a direct child of any other element! anElement must not be nil anIndex must be greater or equal to 1 and less or equal than amount of existing children + 1" self assert: [ anElement isNotNil ] description: [ 'Can not add nil element' ]. self assert: [ anElement ~~ self ] description: [ 'Can not add an element as a child to itself' ]. anElement hasParent ifTrue: [ (BlAlreadyAddedAsChildError element: anElement) signal ]. self assert: [ anElement hasParent not ] description: [ 'Can not add child that is already added to another element!' ]. self assert: [ anIndex between: 1 and: self childrenCount + 1 ] description: [ 'anIndex must be within children array bounds' ]. "update parent" anElement parent: self. "actually add child" self children add: anElement at: anIndex. "dispatch events/hooks after element has been added" self dispatchChildAdded: anElement. "only requesting layout is not enough, because if size or position does not change there will be no invalidated bounds and nothing will be rendered" anElement invalidate. "We should request layout from newly added element to mark it as dirty too" anElement requestLayout. and maximize Coder. Start the profiler. Switch the window to ype in the method coder. And then stop the profiler.

You will get an overview of the frames. Clicking on a frame shows more details.