From 1910545cc9fc1764672ce7a701fcf2f6b4ba3f37 Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Tue, 20 Aug 2024 21:19:53 -0500 Subject: [PATCH] More timing information + ExecutionSteps --- lua/wire/zvm/tests/benchmark_page_bios.lua | 2 +- lua/wire/zvm/zvm_tests.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/wire/zvm/tests/benchmark_page_bios.lua b/lua/wire/zvm/tests/benchmark_page_bios.lua index 9007d2b..14abedc 100644 --- a/lua/wire/zvm/tests/benchmark_page_bios.lua +++ b/lua/wire/zvm/tests/benchmark_page_bios.lua @@ -587,7 +587,7 @@ function Test.Run(CPU,TestSuite) CPU.Frequency = 1e6 TestSuite:Deploy(CPU,TestSuite:LoadFile("palloc_spawn_example.txt"),Test.CompileError) CPU.Clk = 1 - for i = 0, 65536 do + for i = 0, 1024*1024 do CPU:RunStep() end -- On false, will cause test to fail with message diff --git a/lua/wire/zvm/zvm_tests.lua b/lua/wire/zvm/zvm_tests.lua index b1728d9..a038bbd 100644 --- a/lua/wire/zvm/zvm_tests.lua +++ b/lua/wire/zvm/zvm_tests.lua @@ -56,6 +56,7 @@ function ZVMTestSuite.StartTesting() ZVMTestSuite.TestStatuses = {} ZVMTestSuite.Benchmarks = {} ZVMTestSuite.BenchmarksByTest = {} + ZVMTestSuite.StartTime = os.clock() for ind, i in ipairs(ZVMTestSuite.TestFiles) do -- copy with reversed indexes so we can use cheap popping ZVMTestSuite.TestQueue[(#ZVMTestSuite.TestFiles)+1-ind] = i end @@ -131,6 +132,7 @@ function ZVMTestSuite.FinishTest(fail) print("") end print(failed .. " Failed test" .. errormod .. ", " ..passed.. " Passed test" ..passmod.. ", " .. warnstring) + print("Took "..os.clock()-ZVMTestSuite.StartTime.." to execute tests") end end @@ -454,6 +456,7 @@ function ZVMTestSuite.Initialize(VM,Membus,IOBus) FinalCompiledCount = 0, -- Final amount of precompiled blocks at the end of test. ExecutionTime = 0, -- Total execution time during VM:Step LongestStepExecutionTime = 0, -- Longest execution time during VM:Step + ExecutionSteps = 0, -- How many execution steps were performed by this VM } table.insert(ZVMTestSuite.Benchmarks,VM.ZVMBenchmark) @@ -474,6 +477,7 @@ function ZVMTestSuite.Initialize(VM,Membus,IOBus) self.ZVMBenchmark.LongestStepExecutionTime = time end self.ZVMBenchmark.ExecutionTime = self.ZVMBenchmark.ExecutionTime + time + self.ZVMBenchmark.ExecutionSteps = self.ZVMBenchmark.ExecutionSteps + 1 end VM.OriginalPrecompile_Step = VM.OriginalPrecompile_Step or VM.Precompile_Step VM.OriginalPrecompile_Finalize = VM.OriginalPrecompile_Finalize or VM.Precompile_Finalize