Skip to content

Commit fe3dbfb

Browse files
committed
Revert noOutputPrefix to usePatternAsOutputPrefix and just change it to default to false
Readme improvements
1 parent c80a9f8 commit fe3dbfb

File tree

4 files changed

+48
-42
lines changed

4 files changed

+48
-42
lines changed

Readme.md

+39-29
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
# A Factorio Benchmark Powershell Script
22

3+
#### Regular results
4+
5+
![Regular Results Example](results_example.png?raw=true "Regular Results Example")
6+
7+
#### -verboseOutput results
8+
9+
![Verbose Results Example](verbose_example.png?raw=true "Verbose Results Example")
10+
11+
The script doesn't automatically generate graphs but this is an example of
12+
what's possible with per-tick data generated with -verboseOutput
13+
314
## Features:
415

5-
* Aggregation of benchmark data into an output CSV file
16+
* Aggregation of benchmark data into output files
617
* Disabling of mods for the duration of the benchmark
718
* User mods can be enabled by using -enableMods (Useful for modpack benchmarking)
819
* Loading of benchmarked savefiles via -savePath
@@ -11,7 +22,7 @@
1122
separate run results are saved to their own sheets with tick based update times
1223
* Cpu Priority selection via -cpuPriority, defaults to "High"
1324

14-
Various other command line options and flags for customizing functionality.
25+
Various other command line options and flags for customizing functionality per invocation.
1526
Default values can be changed by editing the script, in the params section
1627

1728
## Installation
@@ -50,7 +61,7 @@ Install it by running the following command in powershell:
5061

5162
## Examples
5263

53-
Script will ask ticks and runs and benchmarks all savefiles found in default save location:
64+
#### Script will ask ticks and runs and benchmarks all savefiles found in default save location:
5465

5566
.\benchmark.ps1
5667

@@ -70,7 +81,7 @@ Script will ask ticks and runs and benchmarks all savefiles found in default sav
7081
Executing benchmark after confirmation. Ctrl-c to cancel. Press Enter to continue...:
7182

7283

73-
Giving ticks, runs and save pattern as parameters:
84+
#### Giving ticks, runs and save pattern as parameters:
7485

7586
.\benchmark.ps1 1000 1 "Benchmark"
7687

@@ -88,27 +99,29 @@ Giving ticks, runs and save pattern as parameters:
8899
Inserter Benchmark Run 1 5.5595 seconds
89100

90101

91-
Output results can bee seen in Results folder:
92-
93-
.\Results\flame_sla_10k results.csv:
102+
Output results can bee seen in `Results\Results.csv`:
94103

95104
Save,Run,Startup time,End time,Avg ms,Min ms,Max ms,Ticks,Execution Time ms,Effective UPS,Version,Platform,Calibration
96105
flame_sla_10k,1,10.550,14.873,2.892,2.318,25.153,1000,2891.624,345.83,1.1.110,WindowsSteam,
97106
flame_sla_10k,2,10.483,14.840,2.936,2.358,27.130,1000,2935.500,340.66,1.1.110,WindowsSteam,
98107

99-
Execute using verbose output. This will output an excel file with per-tick data.
108+
#### Execute using verbose output. This will output an xlsx file with per-tick data.
100109

101110
PS> .\benchmark.ps1 1000 2 "flame_sla_10k" -verboseResult
102111

103112
UNMET DEPENDENCY.
104113

105114
Export-Excel cmdlet not found for verbose mode.
106-
Script will continue normally but verbose excel file won't be generated.
115+
Script will continue normally but verbose results file won't be generated.
107116
Please install the dependency by running this command in powershell:
108117

109118
Install-Module ImportExcel -scope CurrentUser
110119

111-
Ctrl-c to cancel. Press Enter to continue...: <Ctrl-C>
120+
Ctrl-c to cancel. Press Enter to continue...:
121+
122+
If the ImportExcel dependency is not installed you will get this message.
123+
124+
Ctrl-c out of it and install the dependency:
112125

113126
PS> Install-Module ImportExcel -scope CurrentUser
114127

@@ -118,6 +131,8 @@ Execute using verbose output. This will output an excel file with per-tick data.
118131
'PSGallery'?
119132
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
120133

134+
Then you're free to retry the command:
135+
121136
PS> .\benchmark.ps1 1000 2 "flame_sla" -verboseResult
122137

123138
Following saves found matching pattern 'flame_sla_10k':
@@ -129,10 +144,7 @@ Execute using verbose output. This will output an excel file with per-tick data.
129144
Benchmarking flame_sla_10k Run 1 2.891624 seconds
130145
Benchmarking flame_sla_10k Run 2 2.9355 seconds
131146

132-
![Verbose Excel Results Example](excel_example.png?raw=true "Verbose Excel Results Example")
133-
134-
The script doesn't generate graphs but this is an example of what's possible by
135-
using per-tick data.
147+
Verbose results can be found in `.\Results\Verbose Results.xlsx`:
136148

137149
## Full Parameter List
138150

@@ -205,14 +217,10 @@ Spreadsheet software just tend to import the data better in more rigid
205217
file formats than .csv which has issues with localization for example with
206218
decimal separators.
207219

208-
### -noOutputPrefix
220+
### -usePatternAsOutputPrefix
209221

210-
By default the -pattern argument is used as a prefix in output filenames
211-
Use this flag to disable this behaviour
212-
213-
This is useful if you never want separate results files ever and just want
214-
to collect all results into one place regardless of your way of selecting
215-
benchmark files
222+
Add -pattern string to output files as prefix.
223+
Useful if you don't want all your results ending up in the same files.
216224

217225
### -keepLogs
218226

@@ -260,14 +268,16 @@ Defaults to High
260268
Specify CPU affinity. Valid values between 0 - 255
261269

262270
Sum the numbers associated with the cores to specify the cores you want factorio to run in.
263-
Core 1 = 1
264-
Core 2 = 2
265-
Core 3 = 4
266-
Core 4 = 8
267-
Core 5 = 16
268-
Core 6 = 32
269-
Core 7 = 64
270-
Core 8 = 128
271+
272+
* Core 1 = 1
273+
* Core 2 = 2
274+
* Core 3 = 4
275+
* Core 4 = 8
276+
* Core 5 = 16
277+
* Core 6 = 32
278+
* Core 7 = 64
279+
* Core 8 = 128
280+
271281
Eg. enabling core 1, 3 and 5 is 1 + 4 + 16 = 21
272282

273283
Defaults to 0 which disables affinity specification altogether

benchmark.ps1

+9-13
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ param (
5959
# Benchmark filenames can be filtered using this pattern
6060
# Defaults to all savefiles found in -savepath
6161
#
62-
# This setting is by default also used as a prefix to the result files
63-
# See -removePatternAsOutputPrefix
62+
# This setting can also be used as a prefix to the result files
63+
# See -usePatternAsOutputPrefix
6464
[string]$pattern = "",
6565

6666
# Factorio config path
@@ -95,11 +95,11 @@ param (
9595

9696
# Base output filename (csv/xlsx)
9797
# Default is results
98-
[string]$outputName = "results",
98+
[string]$outputName = "Results",
9999

100100
# Base verbose output filename (always xlsx)
101101
# Default is verbose
102-
[string]$outputNameVerbose = "verbose",
102+
[string]$outputNameVerbose = "Verbose Results",
103103

104104
# Output results folder
105105
[string]$outputFolder = ".\Results\",
@@ -114,13 +114,9 @@ param (
114114
# decimal separators.
115115
[switch]$forceCSV = $false,
116116

117-
# By default the -pattern argument is used as a prefix in output filenames
118-
# Use this flag to disable this behaviour
119-
#
120-
# This is useful if you never want separate results files ever and just want
121-
# to collect all results into one place regardless of your way of selecting
122-
# benchmark files
123-
[switch]$noOutputPrefix = $false,
117+
# Add -pattern string to output files as prefix.
118+
# Useful if you don't want all your results ending up in the same files.
119+
[switch]$usePatternAsOutputPrefix = $false,
124120

125121
# If given preserve the raw logs produced by factorio.exe
126122
[switch]$keepLogs = $false,
@@ -185,7 +181,7 @@ elseif ($verboseResult) {
185181
Write-Host -NoNewLine "UNMET DEPENDENCY.
186182
187183
Export-Excel cmdlet not found for verbose mode and nicer normal output.
188-
Script will continue normally but verbose excel file won't be generated.
184+
Script will continue normally but verbose results file won't be generated.
189185
Please install the dependency by running this command in powershell:
190186
191187
Install-Module ImportExcel -scope CurrentUser
@@ -234,7 +230,7 @@ if (Test-Path $lockPath) {
234230
}
235231

236232
$sanitized_pattern = ""
237-
if (-not ($noOutputPrefix)) {
233+
if ($usePatternAsOutputPrefix) {
238234
# Remove illegal filename characters from pattern for output filename
239235
$sanitized_pattern = ($pattern.Split([IO.Path]::GetInvalidFileNameChars()) -join '_') + " "
240236
}

results_example.png

61.9 KB
Loading
File renamed without changes.

0 commit comments

Comments
 (0)