Skip to content

Commit

Permalink
More timing information + ExecutionSteps
Browse files Browse the repository at this point in the history
  • Loading branch information
DerelictDrone committed Aug 21, 2024
1 parent 88056bc commit 1910545
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/wire/zvm/tests/benchmark_page_bios.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lua/wire/zvm/zvm_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 1910545

Please sign in to comment.