# Compute the HTML table entries for the output of compute_pi.sh
# [22-Mar-2000]
/^OMP_NUM_THREADS *= *[0-9]/ { N = $3 }
/user.*system.*elapsed/ { report(hhmmss($3)) }
/^real / { report($2) }
function report(seconds)
{
if (T == "")
T = seconds
printf("
%d | %.3f | %.3f |
\n",
N, seconds, T / seconds)
}
function hhmmss(t, n,hh,mm,ss,hms) # convert hh:mm:ss to seconds
{
n = split(t, hms, ":")
# print "DEBUG hhmmss: n = " n " [" $1 "] [" $2 "] [" $3 "]" >"/dev/tty"
if (n == 1)
{
hh = 0
mm = 0
ss = hms[1]
}
else if (n == 2)
{
hh = 0
mm = hms[1]
ss = hms[2]
}
else if (n == 3)
{
hh = hms[1]
mm = hms[2]
ss = hms[3]
}
else
{
print "?n = " n >"/dev/tty"
print "?File ", FILENAME, "line ", FNR, \
": Unknown hh:mm:ss time string: ", t >"/dev/tty"
hh = 0
mm = 0
ss = 0
}
# print "DEBUG: hhmmss ->",(3600 * hh + 60 * mm + ss)
return (3600 * hh + 60 * mm + ss)
}