Profiling the synchronous execution of stylers using message tally

One way to profile Pharo the synchronous code execution is to use Message Tally.

Consider this element which contains an editor of a method:

method := VBNetParser class>>#reduceTable.
coder := GtPharoMethodCoder forMethod: method.
element := coder asElement
  

This method coder has multiple stylers being active. How expensive are they? To find the answer, let's profile their execution. To this end, please inspect it once. Once you do, we can query the active stylers:

stylers := element coderViewModel compositeStyler
  

To profile them we can use MessageTally and provide the block just with the styling instruction:

MessageTally on: [ stylers style: method sourceCode asRopedText ]
  

Inspecting the result shows an instance of MessageTally Magnitude subclass: #MessageTally instanceVariableNames: 'class method process tally receivers senders time gcStats maxClassNameSize maxClassPlusSelectorSize maxTabs reportOtherProcesses' classVariableNames: 'DefaultPollPeriod Timer' package: 'Tool-Profilers-Messages' that provides multiple views that allow us to explore the execution tree in multiple ways.

You also have a quick way to apply message tally on any snippet using the dedicated contextual action.