AUTHORS:
Keeps track of CPU time used between a series of user-defined checkpoints.
It’s probably not a good idea to use this class in an inner loop :-)
EXAMPLE:
sage: def f(): # not tested
... p = Profiler() # not tested
Calling p(message) creates a checkpoint:
sage: p("try factoring 15") # not tested
Do something time-consuming:
sage: x = factor(15) # not tested
You can create a checkpoints without a string; Profiler will use the source code instead:
sage: p() # not tested
sage: y = factor(25) # not tested
sage: p("last step") # not tested
sage: z = factor(35) # not tested
sage: p() # not tested
This will give a nice list of timings between checkpoints:
sage: print p # not tested
Let’s try it out:
sage: f() # not tested
3.020s -- try factoring 15
15.240s -- line 17: y = factor(25)
5000.190s -- last step
See also
Todo
AUTHOR:
x.__init__(...) initializes x; see help(type(x)) for signature
Prints the last profiler step