Skip to content

Commit

Permalink
Add bulk-running mode for TDBBenchmarkRunner to generate historic ben…
Browse files Browse the repository at this point in the history
…chmark data. Works together with benchmark-action/github-action-benchmark#99. Revise state model of TDBBenchmark.
  • Loading branch information
LinqLover committed Jan 9, 2022
1 parent 2cd976a commit 04f93fe
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
hasCompletedOrTimedOut

^ result = #completed or: [result = #running]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
private
performBenchmark

hasRun := false.
result := #running.
totalTime := nil.
preparationTime := Duration zero.
postparationTime := Duration zero.
[self perform: selector.
hasRun := true]
[[self perform: selector.
result := #completed]
valueAndStoreTimeToRunWithoutGC: [:duration |
totalTime := duration.
timeToRun := totalTime - preparationTime - postparationTime].
timeToRun := totalTime - preparationTime - postparationTime]]
on: Error, Warning, Halt
do: [:ex | result := ex].
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"instance" : {
"debug" : "ct 1/8/2022 14:28",
"defaultTimeout" : "ct 1/8/2022 18:42",
"hasRun" : "ct 1/8/2022 16:55",
"hasCompletedOrTimedOut" : "ct 1/9/2022 03:31",
"method" : "ct 1/8/2022 15:58",
"performBenchmark" : "ct 1/8/2022 14:38",
"performBenchmark" : "ct 1/9/2022 17:49",
"postparationTime" : "ct 1/8/2022 19:08",
"postpare:" : "ct 1/8/2022 19:08",
"preparationTime" : "ct 1/8/2022 19:08",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"selector",
"timeout",
"wrappers",
"hasRun",
"result",
"totalTime",
"preparationTime",
"postparationTime",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
instance creation
newDefault

^ self selector: self testSelector
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bulk running
runForVersionsHashes: versionHashes
"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"

| versions workingCopy |
workingCopy := (Smalltalk classNamed: #SquotWorkingCopy) registered
detect: [:ea | ea name = #TraceDebugger].
versions := versionHashes collect: [:hash | workingCopy repository versionAt: hash].

Transcript openIfNone.
versions
do: [:version | | runner |
workingCopy loadVersion: version interactive: false.
runner := self newDefault
resultsFilePath: ('benchmark-results-{1}.json' format: {version hexHash});
yourself.
Transcript showln: 'Runner result:'; show: runner run]
displayingProgress: [:version | 'Running benchmarks for {1}' format: {version}].
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
resultsFilePath: aString

resultsFilePath := aString
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
accessing
resultsFilePath

^ self configAt: #TDBBenchmarkResultsPath ifAbsent: ['TDBBenchmarkResults.json']
^ resultsFilePath ifNil:
[self configAt: #TDBBenchmarkResultsPath ifAbsent: ['TDBBenchmarkResults.json']]
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ test
self exportResults.

self
assert: (self benchmarks allSatisfy: [:bench | (results at: bench) allSatisfy: #hasRun])
assert: (self benchmarks allSatisfy: [:bench | (results at: bench) allSatisfy: [:result | result hasCompletedOrTimedOut]])
description: ['Unsuccessful benchmarks: {1}' format: {self benchmarks
select: [:bench | (results at: bench) anySatisfy: [:ea | ea hasRun not]]}].
select: [:bench | (results at: bench) anySatisfy: [:ea | ea hasCompletedOrTimedOut not]]}].
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"historicDataUrl" : "ct 1/8/2022 22:35",
"historicRawData" : "ct 1/8/2022 22:41",
"historicTimesToRun" : "ct 1/8/2022 22:55",
"newDefault" : "ct 1/9/2022 02:57",
"parseHistoricBench:" : "ct 1/9/2022 02:11",
"parseHistoricRawData:" : "ct 1/9/2022 01:52",
"run" : "ct 1/8/2022 15:39",
"runForVersionsHashes:" : "ct 1/9/2022 17:57",
"testSelector" : "ct 1/8/2022 15:38" },
"instance" : {
"benchmarkClass" : "ct 1/8/2022 15:24",
Expand All @@ -18,10 +20,11 @@
"getEnv:" : "ct 1/8/2022 15:31",
"resultAsJson:" : "ct 1/9/2022 02:07",
"resultsAsJson" : "ct 1/9/2022 01:57",
"resultsFilePath" : "ct 1/8/2022 15:41",
"resultsFilePath" : "ct 1/9/2022 02:57",
"resultsFilePath:" : "ct 1/9/2022 02:57",
"runBenchmarks" : "ct 1/8/2022 18:50",
"setUp" : "ct 1/8/2022 17:52",
"test" : "ct 1/8/2022 17:41",
"test" : "ct 1/9/2022 03:33",
"timesToRepeat" : "ct 1/8/2022 17:30",
"timesToRepeat:" : "ct 1/8/2022 17:30",
"writeResults:toFile:" : "ct 1/8/2022 15:37" } }
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"instvars" : [
"benchmarks",
"results",
"timesToRepeat" ],
"timesToRepeat",
"resultsFilePath" ],
"name" : "TDBBenchmarkRunner",
"pools" : [
],
Expand Down

0 comments on commit 04f93fe

Please sign in to comment.