Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# cython: old_style_globals=True """ Dependency usage tracking for citations """ from __future__ import absolute_import
'sage.libs.singular'] 'sage.rings.finite_rings.element_ntl_gf2e'] 'sage.rings.complex_number'] 'sage.rings.complex_interval']
""" Returns a list of the systems used in running the command ``cmd``. Note that the results can sometimes include systems that did not actually contribute to the computation. Due to caching, it could miss some dependencies as well.
INPUT:
- ``cmd`` - a string to run
.. WARNING::
In order to properly support Cython code, this requires that Sage was compiled with the environment variable ``SAGE_PROFILE=yes``. If this was not the case, a warning will be given when calling this function.
EXAMPLES::
sage: from sage.misc.citation import get_systems sage: get_systems('print("hello")') # random (may print warning) [] sage: integrate(x^2, x) # Priming coercion model 1/3*x^3 sage: get_systems('integrate(x^2, x)') ['ginac', 'Maxima'] sage: R.<x,y,z> = QQ[] sage: I = R.ideal(x^2+y^2, z^2+y) sage: get_systems('I.primary_decomposition()') ['Singular']
Here we get a spurious ``MPFR`` because some coercions need to be initialized. The second time it is gone::
sage: a = var('a') sage: get_systems('((a+1)^2).expand()') ['MPFR', 'ginac'] sage: get_systems('((a+1)^2).expand()') ['ginac'] """
from warnings import warn warn("get_systems() requires Cython profiling to be enabled, " "otherwise the results will be very unreliable. " "Rebuild Sage with the environment variable 'SAGE_PROFILE=yes' " "to enable profiling.")
raise TypeError("command must be a string")
#Run the command and get the stats
#Strings is a list of method names and modules which get run
#Remove trivial functions else:
#Check to see which systems appear in the profiled run
cdef extern from *: int CYTHON_PROFILE """ #ifdef CYTHON_PROFILE CYTHON_PROFILE #else 0 #endif """
cpdef inline bint cython_profile_enabled(): """ Return whether Cython profiling is enabled.
EXAMPLES::
sage: from sage.misc.citation import cython_profile_enabled sage: cython_profile_enabled() # random False sage: type(cython_profile_enabled()) is bool True """ |