Leon Matthes uploaded a new version of CogTools to project VM Maker: http://source.squeak.org/VMMaker/CogTools.threaded-LM.96.mcz
==================== Summary ====================
Name: CogTools.threaded-LM.96 Author: LM Time: 4 December 2023, 6:39:06.829166 pm UUID: 8c382ebd-3fda-40a1-b123-c6169f085677 Ancestors: CogTools.threaded-LM.95
Allow to choose which thread is displayed in VM Profiler.
=============== Diff against CogTools.threaded-LM.95 ===============
Item was changed: ----- Method: SqueakVMProfiler>>openInWindow (in category 'opening') ----- openInWindow "VMProfiler open" | window symbolListMorph labelsMorph buttons | (window := SystemWindow new) setProperty: #allowPaneSplitters toValue: false; model: self; setLabel: self class name; fillStyle: Color white; paneColor: Color white; color: Color white. (window respondsTo: #allowPaneSplitters:) ifTrue: [window allowPaneSplitters: false]. "Cope with Squeak 4.1 SystemWindow background color changes" window addMorph: (AlignmentMorph new color: Color white; yourself) frame: (0@0 corner: 1@1). symbolListMorph := PluggableListMorphOfManyAlt on: self list: #symbolList primarySelection: #symbolIndex changePrimarySelection: nil listSelection: #symbolSelectionAt: changeListSelection: #symbolSelectionAt:put: menu: #symbolListMenu:. symbolListMorph hScrollBarPolicy: #whenNeeded. "buggy misnamed selector :)" labelsMorph := VMProfileGraphLabelMorph model: self font: self labelFont getLabels: #positionedLabels. expressionTextMorph := PluggableTextMorph on: self text: nil accept: nil readSelection: #selectionRange menu: #expressionTextMenu:. expressionTextMorph setProperty: #alwaysAccept toValue: true; askBeforeDiscardingEdits: false; setBalloonText: 'type an expression to profile here'. buttons := OrderedCollection new. window addMorph: symbolListMorph frame: (0@0 corner: 0.15@1); addMorph: (graph := VMProfilePlotMorph model: self) frame: (0.15@0 corner: 1.0@0.7); addMorph: labelsMorph frame: (0.15@0.7 corner: 1.0@0.85); "address boxes" addMorph: (self addressTextMorph:'Type the low address of the histogram here' get: #lowAddressText set: #lowAddressText:) frame: (0.16@0.86 corner: 0.27@0.91); addMorph: (self addressTextMorph:'Type the high address of the histogram here' get: #highAddressText set: #highAddressText:) frame: (0.88@0.86 corner: 0.99@0.91); addMorph: (self totalTextMorph: 'Shows the total number of samples' get: #totalText) frame: (0.88@0.92 corner: 0.99@0.98); "symbol list check-box filters" addMorph: (self checkMorph: 'show module symbols' get: #showingModules set: #toggleShowModules) frame: (0.16@0.915 corner: 0.175@0.93); addMorph: (buttons addLast: (StringMorph contents: 'modules')) frame: (0.19@0.915 corner: 0.27@0.93); addMorph: (self checkMorph: 'show extern symbols' get: #showingPublicFunctions set: #toggleShowPublicFunctions) frame: (0.16@0.935 corner: 0.175@0.95); addMorph: (buttons addLast: (StringMorph contents: 'externs')) frame: (0.19@0.935 corner: 0.27@0.95); addMorph: (self checkMorph: 'show static symbols' get: #showingPrivateFunctions set: #toggleShowPrivateFunctions) frame: (0.16@0.955 corner: 0.175@0.97); addMorph: (buttons addLast: (StringMorph contents: 'statics')) frame: (0.19@0.955 corner: 0.27@0.97); addMorph: (self checkMorph: 'show static symbols' get: #showingLabels set: #toggleShowLabels) frame: (0.16@0.975 corner: 0.175@0.99); addMorph: (buttons addLast: (StringMorph contents: 'labels')) frame: (0.19@0.975 corner: 0.27@0.99); "history buttons" addMorph: (self historyButtonMorph: #backwardsButton help: 'go back to previous selection' set: #regress enable: #hasHistory color: #hasHistoryColor) frame: (0.28@0.86 corner: 0.315@0.90); addMorph: (self historyButtonMorph: #forwardsButton help: 'go forward to next selection' set: #progress enable: #hasFuture color: #hasFutureColor) frame: (0.32@0.86 corner: 0.355@0.90); "profiling buttons" addMorph: (self buttonMorph: #drawButton help: 'plot the graph' set: #plotGraph enable: #notProfilingAndData color: #clearColor) frame: (0.37@0.86 corner: 0.45@0.91); addMorph: (self buttonMorph: #clearButton help: 'clear the histogram data' set: #clearProfile enable: #notProfiling color: #clearColor) frame: (0.46@0.86 corner: 0.54@0.91); addMorph: (self buttonMorph: #startButton help: 'start the profiler' set: #startProfiling enable: #notProfiling color: #profileColor) frame: (0.28@0.915 corner: 0.36@0.96); addMorph: (self buttonMorph: #stopButton help: 'stop the profiler' set: #stopProfiling enable: #profiling color: #stopColor) frame: (0.37@0.915 corner: 0.45@0.96); addMorph: (self buttonMorph: #profileExpressionButton help: 'compile and profile the expression to the right' set: #profileExpression enable: #notProfiling color: #profileColor) frame: (0.46@0.915 corner: 0.54@0.96); addMorph: expressionTextMorph + frame: (0.55@0.86 corner: 0.87@0.96); + addMorph: (self addressTextMorph: 'Thread Index' get: #threadIndexText set: #threadIndexText:) + frame: (0.55@0.96 corner: 0.87@1.0); - frame: (0.55@0.86 corner: 0.87@0.98); addMorph: (self checkMorph: 'Run the full garbage collector prior to profiling' get: #gcPriorToProfile set: #toggleGcPriorToProfile) frame: (0.28@0.97 corner: 0.295@0.985); addMorph: (buttons addLast: (StringMorph contents: 'gc prior')) frame: (0.30@0.97 corner: 0.365@0.995); addMorph: (self checkMorph: 'Clear the profile prior to profiling' get: #clearPriorToProfile set: #toggleClearPriorToProfile) frame: (0.37@0.97 corner: 0.385@0.985); addMorph: (buttons addLast: (StringMorph contents: 'clear prior')) frame: (0.39@0.97 corner: 0.455@0.995); addMorph: (self checkMorph: 'Run the profiled expression in its own process' get: #forkProfile set: #toggleForkProfile) frame: (0.46@0.97 corner: 0.475@0.985); addMorph: (buttons addLast: (StringMorph contents: 'fork profile')) frame: (0.48@0.97 corner: 0.545@0.995). . "A Color transparent fillStyle used to be the default. What a pain that things change so radically from release to release!!" graph fillStyle: Color transparent.
self updateButtons. "weird!!" buttons do: [:buttonMorph| buttonMorph color: Color black]. "otherwise labels don't show :(" window openInWorld. self toggleShowing: #module. ^window!
Item was added: + ----- Method: SqueakVMProfiler>>threadIndexText (in category 'accessing') ----- + threadIndexText + + ^ threadIndex asString!
Item was added: + ----- Method: SqueakVMProfiler>>threadIndexText: (in category 'accessing') ----- + threadIndexText: aText + + aText asString asInteger ifNotNil: [:integer | threadIndex := integer]. + self initializeSamples. + self computeHistograms. + self plotGraph.!
Item was changed: Model subclass: #VMProfiler + instanceVariableNames: 'sampleBuffer sampleBag sortedSamples sortedSymbols sortedSymbolsBeforeCogCode sortedSymbolsAfterCogCode symbolsMode symbolTypes symbolManager symbolList selections minSelectionIndex maxSelectionIndex total rangeTotal highAddress lowAddress history historyIndex expressionTextMorph previousPattern graph aboutToProfile startTime elapsedTime startStats elapsedStats clearPriorToProfile gcPriorToProfile forkProfile cogCodeConstituents withDetails threadIndex' - instanceVariableNames: 'sampleBuffer sampleBag sortedSamples sortedSymbols sortedSymbolsBeforeCogCode sortedSymbolsAfterCogCode symbolsMode symbolTypes symbolManager symbolList selections minSelectionIndex maxSelectionIndex total rangeTotal highAddress lowAddress history historyIndex expressionTextMorph previousPattern graph aboutToProfile startTime elapsedTime startStats elapsedStats clearPriorToProfile gcPriorToProfile forkProfile cogCodeConstituents withDetails' classVariableNames: 'CannedBenchmarkStrings CompatibilityClass' poolDictionaries: '' category: 'CogTools-VMProfiler'!
!VMProfiler commentStamp: 'sk 8/24/2017 15:27' prior: 0! This tool is a pc-sampling profiler for the VM. It presents the profile data graphically.
Copyright© 2011-2013, 3D ICC Immersive Collaboration. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.!
Item was added: + ----- Method: VMProfiler>>computeHistograms (in category 'profiling') ----- + computeHistograms + | numSamples | + sampleBuffer ifNil: + [sampleBuffer := (Smalltalk wordSize = 8 + ifTrue: [DoubleWordArray] + ifFalse: [WordArray]) new: self profileSize]. + numSamples := self getVMProfileThread: threadIndex SamplesInto: sampleBuffer. + Cursor wait showWhile: + [1 to: numSamples do: + [:i| + sampleBag add: (sampleBuffer at: i)]. + sortedSamples := sampleBag sortedElements]. + total := total + numSamples!
Item was changed: ----- Method: VMProfiler>>initializeMost (in category 'initialization') ----- initializeMost self initializeSamples. self clearHistory. symbolsMode := #byAddress. symbolTypes := IdentitySet new. selections := ByteArray new. withDetails := false. expressionTextMorph := PluggableTextMorph new. highAddress := lowAddress := minSelectionIndex := maxSelectionIndex := 0. aboutToProfile := false. total := rangeTotal := startTime := elapsedTime := 0. gcPriorToProfile := clearPriorToProfile := true. + forkProfile := false. + threadIndex := 0.! - forkProfile := false!
Item was changed: ----- Method: VMProfiler>>stopProfiling (in category 'profiling') ----- stopProfiling "still UI-dependent" | numSamples now vmParameters | numSamples := self stopVMProfile. now := Time millisecondClockValue. vmParameters := self getVMParameters. cogCodeConstituents := self primitiveCollectCogCodeConstituents: self withDetails. elapsedTime := now - startTime + elapsedTime. self computeStats: vmParameters. + self computeHistograms. - self computeHistograms: numSamples. self computeCogCodeModule. ('Mac OS' match: Smalltalk platformName) ifTrue: [self computeSortedSymbols]. "workaround. sometimes fails on linux" self clearHistory !
vm-dev@lists.squeakfoundation.org