#9905: Spkg logs should get timestamps
-----------------------------+----------------------------------------------
Reporter: justin | Owner: GeorgSWeber
Type: defect | Status: new
Priority: major | Milestone: sage-4.6.1
Component: build | Keywords:
Author: Justin Walker | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------+----------------------------------------------
Changes (by drkirkby):
* milestone: => sage-4.6.1
Comment:
For performance evaluation, storing the time as seconds since the Epoch
would be useful. A portable way to do this is below:
{{{
# Compute seconds since the Epoch.
# Call 'date'. Note that
# %Y = year including century
# %j = day number (1-365)
# %H = hour (0-23)
# %M = minute (0-59)
# %S = seconds (0-60) - leap seconds mean 60 is permissible.
if type env >/dev/null 2>&1 ; then
set -- `env LC_ALL=C LC_TIME=C LANG=C date -u '+%Y %j %H %M %S'`
else
set -- `date -u '+%Y %j %H %M %S'`
fi
# $1 = year including century
# $2 = day number (1-365)
# $3 = hour (0-23)
# $4 = minute (0-59)
# $5 = seconds (0-60) - leap seconds mean 60 is permissible.
if [ $? -ne 0 ] || [ $# -lt 5 ] ; then
TIME="Error computing seconds since the Epoch"
fi
DAYS=`expr 365 \* \( $1 - 1970 \) + \( $1 - 1969 \) / 4 + $2 - 1`
TIME=`expr $5 + 60 \* \( $4 + 60 \* \( $3 + 24 \* $DAYS \) \)`
echo $TIME
}}}
This was checked by a lot of people on sage-devel
http://groups.google.com/group/sage-
devel/browse_thread/thread/1cf804eeb4f88c27/af8893705de4f513?hl=en&lnk=gst&q=please+check+if+this+#af8893705de4f513
and found to work for everyone. It was tested on
* Linux
* Solaris
* AIX
* HP-UX
* FreeBSD
* OS X
I've played around with it, setting the dates back in years gone by, and
dates in the future, and it always works. It was posted originally on
comp.unix.shell.
If we could save
* Start time in seconds since the Epoch
* End time in seconds since the Ephoch
* Compute the difference, and record that as "TIME TO BUILD" or something
like that
we could use the information to determine if certain components are taking
significantly longer to build.
I'm '''not''' suggesting we only store the time in such a non-human
readable format, but storing seconds since the Epoch in addition to a more
human friendly format seems a good idea to me.
Dave
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9905#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.