OSDN Git Service

PerfTest.cmd: Add the measurement result to the CSV file
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 12 Aug 2021 13:43:06 +0000 (22:43 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 12 Aug 2021 13:43:06 +0000 (22:43 +0900)
Testing/PerfTest.cmd

index 80eb003..4634dde 100644 (file)
@@ -1,14 +1,16 @@
-set exepath=c:\progra~1\winmerge\winmergeu.exe
-for /F "usebackq" %%f in (`powershell -command [System.Diagnostics.FileVersionInfo]::GetVersionInfo^('%exepath%'^).FileVersion`) do (
-  set resultpath=%~dp0\result-%%f-%date:/=-%%time::=.%.txt
+if "%1" == "" (
+  set exepath=c:\progra~1\winmerge\winmergeu.exe
+) else (
+  set exepath=%1
 )
-(
-  echo [MainFrame]
-  powershell -command $^(measure-command { cmd '/c for /L %%i in ^(1,1,10^) do "%exepath%" /noninteractive /noprefs' }^).TotalSeconds
-  echo [MergeEditFrame]
-  powershell -command $^(measure-command { cmd '/c for /L %%i in ^(1,1,10^) do "%exepath%" /noninteractive /noprefs c:\progra~1\winmerge\docs\readme.txt c:\progra~1\winmerge\docs\readme.txt' }^).TotalSeconds
-  echo [DirFrame]
-  powershell -command $^(measure-command { cmd '/c for /L %%i in ^(1,1,10^) do "%exepath%" /noninteractive /noprefs c:\progra~1\winmerge\docs\ c:\progra~1\winmerge\docs\' }^).TotalSeconds
-  echo [Report]
-  powershell -command $^(measure-command { cmd '/c %~dp0\ReportTest.cmd' }^).TotalSeconds
-) > "%resultpath%"
+if not exist %~dp0result.csv (
+  echo Date,Version,MainFrame,MergeEditFrame,DirFrame,Report > "%~dp0result.csv"
+)
+for /F "usebackq" %%f in (`powershell -command [System.Diagnostics.FileVersionInfo]::GetVersionInfo^('%exepath%'^).FileVersion`) do set Version=%%f
+for /F "usebackq" %%f in (`powershell -command $^(measure-command { cmd '/c for /L %%i in ^(1,1,10^) do "%exepath%" /noninteractive /noprefs' }^).TotalSeconds`) do set MainFrame=%%f
+for /F "usebackq" %%f in (`powershell -command $^(measure-command { cmd '/c for /L %%i in ^(1,1,10^) do "%exepath%" /noninteractive /noprefs c:\progra~1\winmerge\docs\readme.txt c:\progra~1\winmerge\docs\readme.txt' }^).TotalSeconds`) do set MergeEditFrame=%%f
+for /F "usebackq" %%f in (`powershell -command $^(measure-command { cmd '/c for /L %%i in ^(1,1,10^) do "%exepath%" /noninteractive /noprefs c:\progra~1\winmerge\docs\ c:\progra~1\winmerge\docs\' }^).TotalSeconds`) do set DirFrame=%%f
+if "%Version:2.16=%" == "%Version%" goto :SKIP_REPORT
+for /F "usebackq" %%f in (`powershell -command $^(measure-command { cmd '/c %~dp0\ReportTest.cmd' }^).TotalSeconds`) do set Report=%%f
+:SKIP_REPORT
+echo %date% %time%,%Version%,%MainFrame%,%MergeEditFrame%,%DirFrame%,%Report% >> "%~dp0result.csv"