1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Author: Svante Signell <svante.signell@gmail.com>
Description: Patch fixes FTBFS on GNU/Hurd
Last-Modified: Fri, 27 Jan 2023 15:38:00 +0300
Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765296
--- a/bitbench.lua
+++ b/bitbench.lua
@@ -19,10 +19,19 @@
local function bench(name, t)
local n = 2000000
+ local s = io.popen("uname -s"):read("*l")
repeat
- local tm = os.clock()
- t(n)
- tm = os.clock() - tm
+ local tm
+-- Clock resolution is 10 ms on GNU/Hurd not 1us
+ if s == "GNU" then
+ tm = 10000*os.clock()
+ t(n)
+ tm = 10000*os.clock() - tm
+ else
+ tm = os.clock()
+ t(n)
+ tm = os.clock() - tm
+ end
if tm > 1 then
local ns = tm*1000/(n/1000000)
io.write(string.format("%-15s %6.1f ns\n", name, ns-base))
|