Skip to content

Commit 04f93fe

Browse files
committed
Add bulk-running mode for TDBBenchmarkRunner to generate historic benchmark data. Works together with benchmark-action/github-action-benchmark#99. Revise state model of TDBBenchmark.
1 parent 2cd976a commit 04f93fe

File tree

12 files changed

+51
-18
lines changed

12 files changed

+51
-18
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
testing
2+
hasCompletedOrTimedOut
3+
4+
^ result = #completed or: [result = #running]

packages/TraceDebuggerBenchmarks.package/TDBBenchmark.class/instance/hasRun.st

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
private
22
performBenchmark
3-
4-
hasRun := false.
3+
4+
result := #running.
55
totalTime := nil.
66
preparationTime := Duration zero.
77
postparationTime := Duration zero.
8-
[self perform: selector.
9-
hasRun := true]
8+
[[self perform: selector.
9+
result := #completed]
1010
valueAndStoreTimeToRunWithoutGC: [:duration |
1111
totalTime := duration.
12-
timeToRun := totalTime - preparationTime - postparationTime].
12+
timeToRun := totalTime - preparationTime - postparationTime]]
13+
on: Error, Warning, Halt
14+
do: [:ex | result := ex].

packages/TraceDebuggerBenchmarks.package/TDBBenchmark.class/methodProperties.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"instance" : {
1515
"debug" : "ct 1/8/2022 14:28",
1616
"defaultTimeout" : "ct 1/8/2022 18:42",
17-
"hasRun" : "ct 1/8/2022 16:55",
17+
"hasCompletedOrTimedOut" : "ct 1/9/2022 03:31",
1818
"method" : "ct 1/8/2022 15:58",
19-
"performBenchmark" : "ct 1/8/2022 14:38",
19+
"performBenchmark" : "ct 1/9/2022 17:49",
2020
"postparationTime" : "ct 1/8/2022 19:08",
2121
"postpare:" : "ct 1/8/2022 19:08",
2222
"preparationTime" : "ct 1/8/2022 19:08",

packages/TraceDebuggerBenchmarks.package/TDBBenchmark.class/properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"selector",
1010
"timeout",
1111
"wrappers",
12-
"hasRun",
12+
"result",
1313
"totalTime",
1414
"preparationTime",
1515
"postparationTime",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
instance creation
2+
newDefault
3+
4+
^ self selector: self testSelector
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
bulk running
2+
runForVersionsHashes: versionHashes
3+
"Run all benchmarks for each of the specified version hashes (aka commit SHAs) and export the results for each version in a separate file. You may check in these results into the github-action-benchmark- database for GitHub pages by passing these files to the run_local.ts script, see: https://github.com/benchmark-action/github-action-benchmark/pull/99"
4+
5+
| versions workingCopy |
6+
workingCopy := (Smalltalk classNamed: #SquotWorkingCopy) registered
7+
detect: [:ea | ea name = #TraceDebugger].
8+
versions := versionHashes collect: [:hash | workingCopy repository versionAt: hash].
9+
10+
Transcript openIfNone.
11+
versions
12+
do: [:version | | runner |
13+
workingCopy loadVersion: version interactive: false.
14+
runner := self newDefault
15+
resultsFilePath: ('benchmark-results-{1}.json' format: {version hexHash});
16+
yourself.
17+
Transcript showln: 'Runner result:'; show: runner run]
18+
displayingProgress: [:version | 'Running benchmarks for {1}' format: {version}].
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
resultsFilePath: aString
3+
4+
resultsFilePath := aString
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
accessing
22
resultsFilePath
33

4-
^ self configAt: #TDBBenchmarkResultsPath ifAbsent: ['TDBBenchmarkResults.json']
4+
^ resultsFilePath ifNil:
5+
[self configAt: #TDBBenchmarkResultsPath ifAbsent: ['TDBBenchmarkResults.json']]

packages/TraceDebuggerBenchmarks.package/TDBBenchmarkRunner.class/instance/test.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ test
66
self exportResults.
77

88
self
9-
assert: (self benchmarks allSatisfy: [:bench | (results at: bench) allSatisfy: #hasRun])
9+
assert: (self benchmarks allSatisfy: [:bench | (results at: bench) allSatisfy: [:result | result hasCompletedOrTimedOut]])
1010
description: ['Unsuccessful benchmarks: {1}' format: {self benchmarks
11-
select: [:bench | (results at: bench) anySatisfy: [:ea | ea hasRun not]]}].
11+
select: [:bench | (results at: bench) anySatisfy: [:ea | ea hasCompletedOrTimedOut not]]}].

0 commit comments

Comments
 (0)