Minor fix for prime-test.lua.

This commit is contained in:
Alexey Kopytov
2017-06-28 19:20:35 +03:00
parent 89f7a5e04a
commit 1e0c5b8cd1

View File

@ -13,16 +13,17 @@ sysbench.cmdline.options = {
}
function event()
n = 0
local n = 0
for c = 3, sysbench.opt.cpu_max_prime do
t = math.sqrt(c)
l = 2
local t = math.sqrt(c)
local isprime = true
for l = 2, t do
if c % l == 0 then
isprime = false
break
end
end
if l > t then
if isprime then
n = n + 1
end
end
@ -34,4 +35,4 @@ function sysbench.hooks.report_intermediate(stat)
stat.time_total,
stat.threads_running,
stat.events / seconds))
end
end