Qian Yun
unread,Dec 1, 2023, 8:36:04 PM12/1/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas-devel
With this patch, the number of digits to be printed in ')time'
output is now configurable via:
)boot $timePrintDigits := 3
As we discussed before, this could be useful -- and after a
few days testing, it is useful.
- Qian
diff --git a/src/interp/g-timer.boot b/src/interp/g-timer.boot
index 326cf2d4..8fc2aa35 100644
--- a/src/interp/g-timer.boot
+++ b/src/interp/g-timer.boot
@@ -48,7 +48,7 @@ makeLongStatStringByProperty _
PUT(cl, classproperty, n + GET(cl, classproperty))
total := total + n
name = 'other or flag ~= 'long => 'iterate
- if n >= 0.01 then
+ if significantStat? n then
str := makeStatString(str, n, name, flag)
else
insignificantStat := insignificantStat + n
@@ -64,18 +64,21 @@ makeLongStatStringByProperty _
normalizeStatAndStringify t ==
FLOATP t =>
- t < 0.01 => '"0"
- FORMAT(nil,'"~,2F",t)
+ not significantStat? t => '"0"
+ fmtStr := STRCONC('"~,", STRINGIMAGE $timePrintDigits, '"F")
+ FORMAT(nil, fmtStr, t)
INTEGERP t => FORMAT(nil, '"~:d", t)
STRINGIMAGE t
makeStatString(oldstr,time,abb,flag) ==
- time < 0.01 => oldstr
+ not significantStat? time => oldstr
opening := (flag = 'long => '"("; '" (")
timestr := normalizeStatAndStringify time
oldstr = '"" => STRCONC(timestr, opening, abb, '")")
STRCONC(oldstr, '" + ", timestr, opening, abb, '")")
+significantStat? t == t >= 0.1^$timePrintDigits
+
peekTimedName() == IFCAR $timedNameStack
popTimedName() ==
@@ -100,6 +103,7 @@ stopTimingProcess name ==
DEFPARAMETER($oldElapsedSpace, 0)
DEFPARAMETER($oldElapsedGCTime, 0.0)
DEFPARAMETER($oldElapsedTime, 0.0)
+DEFPARAMETER($timePrintDigits, 2)
-- $timedNameStack is used to hold the names of sections of the
-- code being timed.