I am logging the RAM usage of sagemath
commands against each other and want to automate it
I found %memit
and I found information on wrapping each [command][How to run an IPython magic from a script (or timing a Python script) but that is not ideal
from sage.all_cmdline import * # import sage library
from sage.misc.sage_timeit import sage_timeit
from IPython import get_ipython
ipython = get_ipython()
if '__IPYTHON__' in globals():
ipython.magic('load_ext autoreload')
ipython.magic('load_ext memory_profiler')
ipython.magic("TIME=%timeit -o print 'test'")
ipython.magic("TIME=%timeit -o print 'test'")
AttributeError: 'NoneType' object has no attribute 'magic'
Is there a better way to use memit
?