Skip to content

Commit

Permalink
Migrating meters
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Nov 22, 2024
1 parent 9c28786 commit 13d7dbd
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 611 deletions.
8 changes: 7 additions & 1 deletion src/BlocBenchs-Core/BlBBlocBenchRunner.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Class {
#category : #'BlocBenchs-Core'
}

{ #category : #adding }
BlBBlocBenchRunner >> addMeter: aBlBMeter [

self meters add: aBlBMeter
]

{ #category : #'as yet unclassified' }
BlBBlocBenchRunner >> cleanUpAfterCase [

Expand Down Expand Up @@ -53,7 +59,7 @@ BlBBlocBenchRunner >> duration: aDuration [
{ #category : #running }
BlBBlocBenchRunner >> meters [

^ meters ifNil: [ meters := self defaultMeters ]
^ meters ifNil: [ meters := self defaultMeters asOrderedCollection ]
]

{ #category : #'as yet unclassified' }
Expand Down
56 changes: 56 additions & 0 deletions src/BlocBenchs-Core/BlBFFICounterMeter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Class {
#name : #BlBFFICounterMeter,
#superclass : #BlBMeter,
#instVars : [
'functionNamesAndCounts'
],
#category : #'BlocBenchs-Core'
}

{ #category : #'as yet unclassified' }
BlBFFICounterMeter >> reportResultsFrom: aBlBBlocBenchRunner in: aBlBResult [

aBlBResult
addField: #totalFFICallsPerFrame
title: 'Total FFI Calls per frame'
value: functionNamesAndCounts values sum.

aBlBResult
addField: #ffiCalls
title: 'FFI Calls per frame'
value: functionNamesAndCounts.

]

{ #category : #'as yet unclassified' }
BlBFFICounterMeter >> startMetering: aBlBBlocBenchRunner [

"Ensure prepared"
TFLSignal install.
TFLFunctionCounter resetInstance.

"Really start"
TFLFunctionCounter start.

aBlBBlocBenchRunner space enableStatistics.
]

{ #category : #'as yet unclassified' }
BlBFFICounterMeter >> stopMetering: aBlBBlocBenchRunner [

"Extract relevant information of the global logger, and reset it."

| frameCount |

frameCount := aBlBBlocBenchRunner space spaceStatistics totalFrames.

functionNamesAndCounts := TFLFunctionCounter instance functionNamesAndCounts.
functionNamesAndCounts := OrderedDictionary newFrom:
(functionNamesAndCounts associations sorted: [ :a :b |
a value > b value ]).
functionNamesAndCounts := functionNamesAndCounts
collect: [ :value | (value / frameCount) asFloat ].

TFLSignal uninstall.
TFLFunctionCounter stop; resetInstance.
]
40 changes: 40 additions & 0 deletions src/BlocBenchs-Core/BlBFFILogger.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Class {
#name : #BlBFFILogger,
#superclass : #BlBMeter,
#instVars : [
'loggerCopy'
],
#category : #'BlocBenchs-Core'
}

{ #category : #'as yet unclassified' }
BlBFFILogger >> reportResultsFrom: aBlBBlocBenchRunner in: aBlBResult [

aBlBResult
addField: #ffiCallsLog
title: 'FFI Calls'
value: loggerCopy
]

{ #category : #'as yet unclassified' }
BlBFFILogger >> startMetering: aBlBBlocBenchRunner [

"Ensure prepared"
TFLSignal install.
TFLCallLogger resetInstance.
TFLCallLogger instance entryCount: 20000.

"Really start"
TFLCallLogger instance start
]

{ #category : #'as yet unclassified' }
BlBFFILogger >> stopMetering: aBlBBlocBenchRunner [

"Store a copy of the global logger, and reset it."

loggerCopy := TFLCallLogger instance copy.

TFLSignal uninstall.
TFLCallLogger stop; resetInstance.
]
56 changes: 56 additions & 0 deletions src/BlocBenchs-Core/BlBSystemProfilerMeter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Class {
#name : #BlBSystemProfilerMeter,
#superclass : #BlBMeter,
#instVars : [
'profiler'
],
#category : #'BlocBenchs-Core'
}

{ #category : #'as yet unclassified' }
BlBSystemProfilerMeter >> reportResultsFrom: aBlBBlocBenchRunner in: aBlBResult [

| flameGraph |

flameGraph := profiler saucoAsReport
colorMap:
(SaCategoryPrefixColorMap new
mapPrefixes: #(
'OSWindow'
'Alexandrie')
from: Color lightBlue;
mapPrefixes: #(
'Bloc-Text'
'BlocHost'
'Bloc')
from: Color orange;
mapPrefixes: #(
'Album'
'Toplo')
from: Color pink;
yourself) .

aBlBResult
addField: #systemProfilerReport
title: 'System Profiler Report'
value: profiler report.

aBlBResult
addField: #flameGraph
title: 'Flame Graph'
value: flameGraph.

]

{ #category : #'as yet unclassified' }
BlBSystemProfilerMeter >> startMetering: aBlBBlocBenchRunner [

profiler := AndreasSystemProfiler new.
profiler startProfiling
]

{ #category : #'as yet unclassified' }
BlBSystemProfilerMeter >> stopMetering: aBlBBlocBenchRunner [

profiler stopProfiling
]
59 changes: 0 additions & 59 deletions src/BlocBenchs-Old/BlAndreasSystemProfiler.class.st

This file was deleted.

78 changes: 0 additions & 78 deletions src/BlocBenchs-Old/BlFFICounter.class.st

This file was deleted.

39 changes: 0 additions & 39 deletions src/BlocBenchs-Old/BlFFILogger.class.st

This file was deleted.

Loading

0 comments on commit 13d7dbd

Please sign in to comment.