Opened 12 months ago
Closed 6 months ago
#31368 closed defect (fixed)
time in *.sage file
Reported by: | hemmecke | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.4 |
Component: | misc | Keywords: | |
Cc: | Merged in: | ||
Authors: | John Palmieri | Reviewers: | Kwankyu Lee |
Report Upstream: | N/A | Work issues: | |
Branch: | ca407e4 (Commits, GitHub, GitLab) | Commit: | ca407e4f74f3fa30c9f64e796ff6496400082adc |
Dependencies: | Stopgaps: |
Description
In Sage 9.1 or 9.2, I can type this and get some timing output.
sage: time a=1+2 CPU times: user 5 µs, sys: 2 µs, total: 7 µs Wall time: 7.63 µs
However, when I put
time a=1+2
into footime.sage
and then run
sage footime.sage
I see the following output:
Traceback (most recent call last): File "footime.sage.py", line 7, in <module> __time__=misc.cputime(); __wall__=misc.walltime(); a = _sage_const_1 +_sage_const_2 ; print("Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__), misc.walltime(__wall__))) NameError: name 'misc' is not defined
There is a generated footime.sage.py
with the following content.
# This file was *autogenerated* from the file footime.sage from sage.all_cmdline import * # import sage library _sage_const_1 = Integer(1); _sage_const_2 = Integer(2) __time__=misc.cputime(); __wall__=misc.walltime(); a = _sage_const_1 +_sage_const_2 ; print("Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__), misc.walltime(__wall__)))
Change History (10)
comment:1 Changed 12 months ago by
- Branch set to u/jhpalmieri/preparse-time
comment:2 Changed 12 months ago by
- Commit set to 3c626b8d0155af6d740cc340aae94546ee013f16
- Status changed from new to needs_review
comment:3 Changed 10 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.
comment:4 Changed 10 months ago by
You can use cputime()
and walltime()
instead of sage.misc.misc.cputime()
and sage.misc.misc.walltime()
. They are imported by from sage.all_cmdline import *
comment:5 Changed 10 months ago by
- Reviewers set to Kwankyu Lee
comment:6 Changed 10 months ago by
- Commit changed from 3c626b8d0155af6d740cc340aae94546ee013f16 to ca407e4f74f3fa30c9f64e796ff6496400082adc
comment:7 Changed 10 months ago by
Okay, done.
comment:8 Changed 9 months ago by
- Status changed from needs_review to positive_review
comment:9 Changed 6 months ago by
- Priority changed from minor to major
Promoting the oldest 5 positively reviewed tickets to "major"
comment:10 Changed 6 months ago by
- Branch changed from u/jhpalmieri/preparse-time to ca407e4f74f3fa30c9f64e796ff6496400082adc
- Resolution set to fixed
- Status changed from positive_review to closed
I think this should fix it.
New commits:
trac 31368: fix preparsing of "time"