以vraybench cli为例,介绍如何把一个命令行压测程序跑在指定vCPU上,我这篇文档结尾有介绍0x8000为何代指vCPU15
https://cloud.tencent.com/developer/article/2550146
#c:\vray-benchmark-6.00.02-cli.exe -m vray
$client1 = new-object System.Net.WebClient
$client1.DownloadFile('下载链接','c:\vray-benchmark-6.00.02-cli.exe')
del c:\log*.txt
cmd /c 'rd /q /s "C:\V-Ray Benchmark\"'
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|c:\vray-benchmark-6.00.02-cli.exe -m vray 2>&1 1>c:\log1.txt"}
Start-Sleep 25
#这里等待时间必须恰到好处(短了没释放完全,长了则已经运行完毕自动删除,建议等30秒左右)才能拿到vray-benchmark-6.00.02-cli.exe释放出来的完整文件到C:\V-Ray Benchmark\
cmd.exe /c xcopy /S /E /F /H /Y /Q "%temp%\V-Ray Benchmark" "C:\V-Ray Benchmark\"
#释放出的文件多少跟当前系统的VC库版本有关系
#不安装vc库的情况,释放的文件夹有300+文件,其中就有vc2015版的vcruntime140.dll
#安装了vc2022的情况下,释放的文件夹有250+文件,其中没有vcruntime140.dll,会直接调用操作系统C:\Windows\System32\vcruntime140.dll,这个vc2022版的vcruntime140.dll会导致CPU降频
#250+文件的情况下,手动把vc2015版的vcruntime140.dll放到跟V-Ray Benchmark (CLI).exe同级目录,这样来跑CPU压测,能规避操作系统级别vc2022版的vcruntime140.dll的影响
#拿到释放出来的文件夹,就可以压缩它以备后用,这样以后每次运行这个文件夹里的内容,就不必每次由.exe释放到temp目录了(释放出什么文件看系统VC库环境)
#手动执行,等待足够长时间让单次压测跑完,一般需要2分钟左右
start-sleep 150
cd "C:\V-Ray Benchmark\resources\app\scenes\"
cmd /c rename "..\bin\V-Ray Benchmark (CLI).exe" vraycli.exe
#之所以重命名是因为单双引号不好处理"V-Ray Benchmark (CLI).exe"这个名称
#这里在前面加echo ""其实是回车换行,因为运行vray命令行的时候如果不打印日志,你会看到一个y/n的交互,直接回车换行就相当于敲y
#多跑几次,搜日志文件c:\log.txt里的"V-Ray score"算平均值
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log2.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log3.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log4.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log5.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log6.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log7.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log8.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log9.txt"}
start-sleep 150
Start-Process cmd.exe -ArgumentList {/c start /wait /affinity 0x8000 cmd /c "echo Y|..\bin\vraycli.exe -m vray 2>&1 1>c:\log0.txt"}
也可以参考下面这篇文档里的openssl.exe命令行验证单核性能
https://cloud.tencent.com/developer/article/1923251
还可以手动在任务管理器→ 详细信息→ 找到CineBench进程然后右键"设置相关性"选定一个逻辑处理器来测试单核性能
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。