2
2
.AUTHOR
3
3
sp00n
4
4
.VERSION
5
- 0.8.0.0 RC2
5
+ 0.8.0.0 RC3
6
6
. DESCRIPTION
7
7
Sets the affinity of the selected stress test program process to only one core and cycles through
8
8
all the cores to test the stability of a Curve Optimizer setting
17
17
#>
18
18
19
19
# Global variables
20
- $version = ' 0.8.0.0 RC2 '
20
+ $version = ' 0.8.0.0 RC3 '
21
21
$curDateTime = Get-Date - format yyyy- MM- dd_HH- mm- ss
22
22
$logFilePath = ' logs'
23
23
$logFilePathAbsolute = $PSScriptRoot + ' \' + $logFilePath + ' \'
@@ -80,6 +80,8 @@ $stressTestPrograms = @{
80
80
' fullPathToExe' = $null
81
81
' testModes' = @ (
82
82
' CACHE' ,
83
+ ' CPU' ,
84
+ ' FPU' ,
83
85
' RAM'
84
86
)
85
87
' windowNames' = @ (
@@ -197,7 +199,7 @@ $GetWindowsDefinition = @'
197
199
private static CallBackPtr callBackPtr = Callback;
198
200
private static List<WinStruct> _WinStructList = new List<WinStruct>();
199
201
200
- [DllImport("User32 .dll")]
202
+ [DllImport("user32 .dll")]
201
203
[return: MarshalAs(UnmanagedType.Bool)]
202
204
private static extern bool EnumWindows(CallBackPtr lpEnumFunc, IntPtr lParam);
203
205
@@ -1146,9 +1148,9 @@ function Get-Settings {
1146
1148
$settings.General.numberOfThreads = $ (if ($isHyperthreadingEnabled ) { $settings.General.numberOfThreads } else { 1 })
1147
1149
1148
1150
1149
- # Default the stress test program to prime95
1151
+ # If the selected stress test program is not supported
1150
1152
if (! $settings.General.stressTestProgram -or ! $stressTestPrograms.Contains ($settings.General.stressTestProgram )) {
1151
- $settings.General.stressTestProgram = ' prime95 '
1153
+ Exit-WithFatalError ( ' The selected stress test program " ' + $settings.General.stressTestProgram + ' " could not be found! ' )
1152
1154
}
1153
1155
1154
1156
@@ -1173,8 +1175,14 @@ function Get-Settings {
1173
1175
1174
1176
1175
1177
# Sanity check the selected test mode
1176
- if (! $stressTestPrograms [$settings.General.stressTestProgram ][' testModes' ].Contains($settings.mode )) {
1177
- Exit-WithFatalError (' The selected test mode "' + $settings.mode + ' " is not available for ' + $stressTestPrograms [$settings.General.stressTestProgram ][' displayName' ] + ' !' )
1178
+ # For Aida64, you can set a comma separated list of multiple stress tests
1179
+ $modesArray = $settings.mode -Split ' ,\s*'
1180
+ $modeString = $modesArray -Join ' -'
1181
+
1182
+ foreach ($mode in $modesArray ) {
1183
+ if (! $stressTestPrograms [$settings.General.stressTestProgram ][' testModes' ].Contains($mode )) {
1184
+ Exit-WithFatalError (' The selected test mode "' + $mode + ' " is not available for ' + $stressTestPrograms [$settings.General.stressTestProgram ][' displayName' ] + ' !' )
1185
+ }
1178
1186
}
1179
1187
1180
1188
@@ -1183,7 +1191,7 @@ function Get-Settings {
1183
1191
1184
1192
1185
1193
# Set the final full path and name of the log file
1186
- $Script :logFileName = $settings.Logging.name + ' _' + $curDateTime + ' _' + $settings.General.stressTestProgram.ToUpper () + ' _' + $settings .mode + ' .log'
1194
+ $Script :logFileName = $settings.Logging.name + ' _' + $curDateTime + ' _' + $settings.General.stressTestProgram.ToUpper () + ' _' + $modeString + ' .log'
1187
1195
$Script :logFileFullPath = $logFilePathAbsolute + $logFileName
1188
1196
}
1189
1197
@@ -1738,17 +1746,13 @@ function Initialize-Prime95 {
1738
1746
}
1739
1747
1740
1748
1741
- $configType = $settings.mode
1749
+ $modeString = $settings.mode
1742
1750
$configFile1 = $stressTestPrograms [' prime95' ][' absolutePath' ] + ' local.txt'
1743
1751
$configFile2 = $stressTestPrograms [' prime95' ][' absolutePath' ] + ' prime.txt'
1744
1752
1745
1753
1746
- if ($configType -ne ' CUSTOM' -and $configType -ne ' SSE' -and $configType -ne ' AVX' -and $configType -ne ' AVX2' ) {
1747
- Exit-WithFatalError (' Invalid mode type provided!' )
1748
- }
1749
-
1750
1754
# The Prime95 results.txt file name and path for this run
1751
- $Script :stressTestLogFileName = ' Prime95_' + $curDateTime + ' _' + $configType + ' _' + $settings.Prime95.FFTSize + ' _FFT_' + $minFFTSize + ' K-' + $maxFFTSize + ' K.txt'
1755
+ $Script :stressTestLogFileName = ' Prime95_' + $curDateTime + ' _' + $modeString + ' _' + $settings.Prime95.FFTSize + ' _FFT_' + $minFFTSize + ' K-' + $maxFFTSize + ' K.txt'
1752
1756
$Script :stressTestLogFilePath = $logFilePathAbsolute + $stressTestLogFileName
1753
1757
1754
1758
# Create the local.txt and overwrite if necessary
@@ -1767,11 +1771,11 @@ function Initialize-Prime95 {
1767
1771
Add-Content $configFile1 (' CoresPerTest=1' )
1768
1772
Add-Content $configFile1 (' CpuNumHyperthreads=' + $settings.General.numberOfThreads )
1769
1773
Add-Content $configFile1 (' WorkerThreads=' + $settings.General.numberOfThreads )
1770
- Add-Content $configFile1 (' CpuSupportsSSE=' + $prime95CPUSettings [$configType ].CpuSupportsSSE)
1771
- Add-Content $configFile1 (' CpuSupportsSSE2=' + $prime95CPUSettings [$configType ].CpuSupportsSSE2)
1772
- Add-Content $configFile1 (' CpuSupportsAVX=' + $prime95CPUSettings [$configType ].CpuSupportsAVX)
1773
- Add-Content $configFile1 (' CpuSupportsAVX2=' + $prime95CPUSettings [$configType ].CpuSupportsAVX2)
1774
- Add-Content $configFile1 (' CpuSupportsFMA3=' + $prime95CPUSettings [$configType ].CpuSupportsFMA3)
1774
+ Add-Content $configFile1 (' CpuSupportsSSE=' + $prime95CPUSettings [$modeString ].CpuSupportsSSE)
1775
+ Add-Content $configFile1 (' CpuSupportsSSE2=' + $prime95CPUSettings [$modeString ].CpuSupportsSSE2)
1776
+ Add-Content $configFile1 (' CpuSupportsAVX=' + $prime95CPUSettings [$modeString ].CpuSupportsAVX)
1777
+ Add-Content $configFile1 (' CpuSupportsAVX2=' + $prime95CPUSettings [$modeString ].CpuSupportsAVX2)
1778
+ Add-Content $configFile1 (' CpuSupportsFMA3=' + $prime95CPUSettings [$modeString ].CpuSupportsFMA3)
1775
1779
1776
1780
1777
1781
@@ -1795,7 +1799,7 @@ function Initialize-Prime95 {
1795
1799
Add-Content $configFile2 (' results.txt=' + $logFilePath + ' \' + $stressTestLogFileName )
1796
1800
1797
1801
# Custom settings
1798
- if ($configType -eq ' CUSTOM' ) {
1802
+ if ($modeString -eq ' CUSTOM' ) {
1799
1803
Add-Content $configFile2 (' TortureMem=' + $settings.Custom.TortureMem )
1800
1804
Add-Content $configFile2 (' TortureTime=' + $settings.Custom.TortureTime )
1801
1805
}
@@ -1848,14 +1852,21 @@ function Start-Prime95 {
1848
1852
# $Script:windowProcess = Start-Process -filepath $stressTestPrograms['prime95']['fullPathToExe'] -ArgumentList '-t' -PassThru -WindowStyle Minimized
1849
1853
1850
1854
# This doesn't steal the focus
1851
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('"' + $stressTestPrograms['prime95']['fullPathToExe'] + '" -t'), 'MinimizedNoFocus')
1852
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('"' + $stressTestPrograms['prime95']['fullPathToExe'] + '" -t'), 'NormalNoFocus')
1853
- $processId = [Microsoft.VisualBasic.Interaction ]::Shell((' "' + $stressTestPrograms [' prime95' ][' fullPathToExe' ] + ' " -t' ), ' Hide' )
1854
-
1855
- $Script :windowProcess = Get-Process - Id $processId
1855
+ # 0 = Hide
1856
+ # 1 = NormalFocus
1857
+ # 2 = MinimizedFocus
1858
+ # 3 = MaximizedFocus
1859
+ # 4 = NormalNoFocus
1860
+ # 6 = MinimizedNoFocus
1861
+ $windowBehaviour = 0
1862
+ $fullPathToExe = $stressTestPrograms [' prime95' ][' fullPathToExe' ]
1863
+ $command = " "" ${fullPathToExe} "" -t"
1864
+ $processId = [Microsoft.VisualBasic.Interaction ]::Shell($command , $windowBehaviour )
1856
1865
1857
1866
# This might be necessary to correctly read the process. Or not
1858
1867
Start-Sleep - Milliseconds 500
1868
+
1869
+ $Script :windowProcess = Get-Process - Id $processId - ErrorAction Ignore
1859
1870
1860
1871
if (! $Script :windowProcess ) {
1861
1872
Exit-WithFatalError (' Could not start the process "' + $stressTestPrograms [' prime95' ][' processName' ] + ' "!' )
@@ -1972,7 +1983,8 @@ function Initialize-Aida64 {
1972
1983
}
1973
1984
1974
1985
1975
- $configType = $settings.mode
1986
+ $modesArray = $settings.mode -Split ' ,\s*'
1987
+ $modeString = $modesArray -Join ' -'
1976
1988
1977
1989
# TODO: Do we want to offer a way to start Aida64 with admin rights?
1978
1990
$hasAdminRights = $false
@@ -1995,16 +2007,13 @@ function Initialize-Aida64 {
1995
2007
}
1996
2008
1997
2009
# The Aida64 log file name and path for this run
1998
- $Script :stressTestLogFileName = ' Aida64_' + $curDateTime + ' _' + $settings .mode + ' .csv'
2010
+ $Script :stressTestLogFileName = ' Aida64_' + $curDateTime + ' _' + $modeString + ' .csv'
1999
2011
$Script :stressTestLogFilePath = $logFilePathAbsolute + $stressTestLogFileName
2000
2012
2001
2013
# The aida64.ini and aida64.sst.ini
2002
2014
$configFile1 = $stressTestPrograms [' aida64' ][' absolutePath' ] + ' aida64.ini'
2003
2015
$configFile2 = $stressTestPrograms [' aida64' ][' absolutePath' ] + ' aida64.sst.ini'
2004
2016
2005
- if ($configType -ne ' CACHE' -and $configType -ne ' RAM' ) {
2006
- Exit-WithFatalError (' Invalid mode type provided!' )
2007
- }
2008
2017
2009
2018
# Create the aida64.ini and overwrite if necessary
2010
2019
$null = New-Item $configFile1 - ItemType File - Force
@@ -2114,12 +2123,12 @@ function Initialize-Aida64 {
2114
2123
}
2115
2124
2116
2125
2117
- # No AVX
2118
- Set-Content $configFile2 (' UseAVX=0' )
2119
- Add-Content $configFile2 (' UseAVX512=0' )
2120
-
2121
2126
# Start the stress test on max 2 threads, not on all
2122
- Add-Content $configFile2 (' CPUMaskAuto=0' )
2127
+ Set-Content $configFile2 (' CPUMaskAuto=0' )
2128
+
2129
+ # Use AVX?
2130
+ Add-Content $configFile2 (' UseAVX=' + $settings.Aida64.useAVX )
2131
+ Add-Content $configFile2 (' UseAVX512=' + $settings.Aida64.useAVX )
2123
2132
2124
2133
# On CPU 2 & 3 if 2 threads
2125
2134
if ($settings.General.numberOfThreads -gt 1 ) {
@@ -2130,8 +2139,8 @@ function Initialize-Aida64 {
2130
2139
Add-Content $configFile2 (' CPUMask=0x00000004' )
2131
2140
}
2132
2141
2133
- # Maybe use this later on to limit the amount of memory used for the RAM test?
2134
- # Add-Content $configFile1 ('MemAlloc=95' )
2142
+ # Set the maximum amount of memory during the RAM stress test
2143
+ Add-Content $configFile2 (' MemAlloc=' + $settings .Aida64.maxMemory )
2135
2144
}
2136
2145
2137
2146
@@ -2165,13 +2174,19 @@ function Start-Aida64 {
2165
2174
Write-Verbose (' Starting the main window process' )
2166
2175
}
2167
2176
2168
- # Minimized to the task bar
2169
2177
# This doesn't steal the focus
2170
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('"' + $stressTestPrograms['aida64']['fullPathToExe'] + '" /SAFEST /SILENT /SST ' + $thisMode), 'NormalNoFocus')
2171
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('"' + $stressTestPrograms['aida64']['fullPathToExe'] + '" /SAFEST /SILENT /SST ' + $thisMode), 'Hide')
2172
- $processId = [Microsoft.VisualBasic.Interaction ]::Shell((' "' + $stressTestPrograms [' aida64' ][' fullPathToExe' ] + ' " /SAFEST /SILENT /SST ' + $thisMode ), ' MinimizedNoFocus' )
2178
+ # 0 = Hide
2179
+ # 1 = NormalFocus
2180
+ # 2 = MinimizedFocus
2181
+ # 3 = MaximizedFocus
2182
+ # 4 = NormalNoFocus
2183
+ # 6 = MinimizedNoFocus
2184
+ $windowBehaviour = 6
2185
+ $fullPathToExe = $stressTestPrograms [' aida64' ][' fullPathToExe' ]
2186
+ $command = " "" ${fullPathToExe} "" /SAFEST /SILENT /SST ${thisMode} "
2187
+ $processId = [Microsoft.VisualBasic.Interaction ]::Shell($command , $windowBehaviour )
2173
2188
2174
- $Script :windowProcess = Get-Process - Id $processId
2189
+ $Script :windowProcess = Get-Process - Id $processId - ErrorAction Ignore
2175
2190
2176
2191
# /SST = Directly starts the System Stability Test (available tests: Cache, RAM, CPU, FPU, Disk, GPU)
2177
2192
# /SILENT = No tray icon, which can stay behind if the main window process is killed
@@ -2436,7 +2451,7 @@ function Initialize-YCruncher {
2436
2451
Exit-WithFatalError
2437
2452
}
2438
2453
2439
- $configType = $settings.mode
2454
+ $modeString = $settings.mode
2440
2455
$configName = ' stressTest.cfg'
2441
2456
$configFile = $stressTestPrograms [' ycruncher' ][' absolutePath' ] + $configName
2442
2457
@@ -2525,33 +2540,34 @@ function Start-YCruncher {
2525
2540
# This doesn't steal the focus
2526
2541
# We need to use conhost, otherwise the output would be inside the current console window
2527
2542
# Caution, calling conhost here will also return the process id of the conhost.exe file, not the one for the Y-Cruncher binary!
2528
-
2529
-
2530
- # TODO: There seem to be some problems with starting the process here. Need to investigate
2531
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('conhost "' + $stressTestPrograms['ycruncher']['fullPathToExe'] + '" config \"' + $stressTestConfigFilePath + '\"'), 'MinimizedNoFocus')
2532
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('conhost "' + $stressTestPrograms['ycruncher']['fullPathToExe'] + '" config \"' + $stressTestConfigFilePath + '\"'), 'NormalNoFocus')
2533
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('conhost "' + $stressTestPrograms['ycruncher']['fullPathToExe'] + '" config \"' + $stressTestConfigFilePath + '\"'), 'Hide')
2534
-
2535
-
2536
2543
# The escape character in Visual Basic for double quotes seems to be... a double quote!
2537
2544
# So a triple double quote is actually interpreted as a single double quote here
2538
- $processId = [Microsoft.VisualBasic.Interaction ]::Shell((' conhost """' + $stressTestPrograms [' ycruncher' ][' fullPathToExe' ] + ' """ config """' + $stressTestConfigFilePath + ' """' ), ' MinimizedNoFocus' )
2539
-
2545
+ # $processId = [Microsoft.VisualBasic.Interaction]::Shell(("conhost.exe """ + $stressTestPrograms['ycruncher']['fullPathToExe'] + """ config """ + $stressTestConfigFilePath + """"), 6) # 6 = MinimizedNoFocus
2540
2546
2541
- # Possible alternative using cmd /K with even more quotes
2542
- # Note that this will not work with the GetWindows() call to match against "^.*00-x86\.exe$", as the window title doesn't end with .exe, but with
2543
- # "[...]00-x86.exe" config "[...]\stressTest.cfg"
2544
- # $processId = [Microsoft.VisualBasic.Interaction]::Shell(('conhost.exe cmd /K """"""' + $fullPathToExe + '""" config """' + $stressTestConfigFilePath + '""""""'), 'MinimizedNoFocus')
2547
+ # 0 = Hide
2548
+ # 1 = NormalFocus
2549
+ # 2 = MinimizedFocus
2550
+ # 3 = MaximizedFocus
2551
+ # 4 = NormalNoFocus
2552
+ # 6 = MinimizedNoFocus
2553
+ $windowBehaviour = 6
2545
2554
2546
-
2547
- # Cannot use the returned $processId here
2548
- # $Script:windowProcess = Get-Process -Id $processId
2549
- $Script :windowProcess = Get-Process $stressTestPrograms [' ycruncher' ][' processName' ]
2555
+ # Apparently on some computers (not mine) the windows title is not set to the binary path, so the Get-StressTestWindowHandler function doesn't work
2556
+ # Therefore we're now using "cmd /C start" to be able to set a window title...
2557
+ $fileName = $stressTestPrograms [' ycruncher' ][' processName' ] + ' .' + $stressTestPrograms [' ycruncher' ][' processNameExt' ]
2558
+ $fullPathToExe = $stressTestPrograms [' ycruncher' ][' fullPathToExe' ]
2559
+ $command = " cmd /C start /MIN "" Y-Cruncher - ${fileName} "" "" ${fullPathToExe} "" config "" ${stressTestConfigFilePath} "" "
2560
+ $processId = [Microsoft.VisualBasic.Interaction ]::Shell($command , $windowBehaviour )
2550
2561
2551
2562
2552
2563
# This might be necessary to correctly read the process. Or not
2553
2564
Start-Sleep - Milliseconds 500
2554
-
2565
+
2566
+
2567
+ # Cannot use the returned $processId here
2568
+ # $Script:windowProcess = Get-Process -Id $processId
2569
+ $Script :windowProcess = Get-Process $stressTestPrograms [' ycruncher' ][' processName' ] - ErrorAction Ignore
2570
+
2555
2571
if (! $Script :windowProcess ) {
2556
2572
Exit-WithFatalError (' Could not start the process "' + $stressTestPrograms [' ycruncher' ][' processName' ] + ' "!' )
2557
2573
}
@@ -3175,16 +3191,7 @@ if (!$counter) {
3175
3191
$selectedStressTestProgram = $stressTestPrograms [$settings.General.stressTestProgram ][' displayName' ]
3176
3192
3177
3193
# Set the correct process name
3178
- # Eventually this could be something different than just Prime95
3179
- if ($stressTestPrograms.Contains ($settings.General.stressTestProgram )) {
3180
- $processName = $stressTestPrograms [$settings.General.stressTestProgram ][' processNameForLoad' ]
3181
- }
3182
-
3183
- # Default is Prime95
3184
- else {
3185
- $processName = $stressTestPrograms [' prime95' ][' processNameForLoad' ]
3186
- }
3187
-
3194
+ $processName = $stressTestPrograms [$settings.General.stressTestProgram ][' processNameForLoad' ]
3188
3195
3189
3196
# Check if the stress test process is already running
3190
3197
$stressTestProcess = Get-Process $processName - ErrorAction Ignore
@@ -3498,7 +3505,7 @@ for ($iteration = 1; $iteration -le $settings.General.maxIterations; $iteration+
3498
3505
Write-ColorText (' Apparently Aida64 doesn'' t like running the stress test on the first thread of Core 0.' ) Black Yellow
3499
3506
Write-ColorText (' Setting it to thread 2 of Core 0 instead (Core 0 CPU 1).' ) Black Yellow
3500
3507
3501
- $affinity = 2
3508
+ $affinity = [ System.IntPtr ][ Int64 ] 2
3502
3509
$cpuNumber = 1
3503
3510
$cpuNumberString = 1
3504
3511
}
@@ -3570,7 +3577,7 @@ for ($iteration = 1; $iteration -le $settings.General.maxIterations; $iteration+
3570
3577
Start-Sleep - Milliseconds 300
3571
3578
3572
3579
try {
3573
- $stressTestProcess.ProcessorAffinity = $affinity
3580
+ $stressTestProcess.ProcessorAffinity = [ System.IntPtr ][ Int64 ] $affinity
3574
3581
}
3575
3582
catch {
3576
3583
Close-StressTestProgram
0 commit comments