2016-12-19 06:10:24 +01:00
|
|
|
==========
|
|
|
|
Profile
|
|
|
|
==========
|
|
|
|
|
|
|
|
.. versionadded:: 0.10.0
|
|
|
|
|
2016-12-19 23:44:16 +01:00
|
|
|
The ``profile`` macros make it easier to find bottlenecks.
|
2016-12-19 06:10:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
Macros
|
|
|
|
======
|
|
|
|
|
|
|
|
.. _profile/calls:
|
|
|
|
.. _profile/cpu:
|
|
|
|
|
|
|
|
profile/calls
|
|
|
|
--------------
|
|
|
|
|
2018-05-16 05:29:07 +02:00
|
|
|
``profile/calls`` allows you to create a call graph visualization.
|
2019-08-17 09:39:04 +02:00
|
|
|
**Note:** You must have `Graphviz <http://www.graphviz.org/>`_
|
2016-12-19 06:10:24 +01:00
|
|
|
installed for this to work.
|
|
|
|
|
|
|
|
|
2018-05-16 05:29:07 +02:00
|
|
|
Usage: `(profile/calls (body))`
|
2016-12-19 06:10:24 +01:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
.. code-block:: hy
|
|
|
|
|
|
|
|
(require [hy.contrib.profile [profile/calls]])
|
|
|
|
(profile/calls (print "hey there"))
|
|
|
|
|
|
|
|
|
|
|
|
profile/cpu
|
|
|
|
------------
|
|
|
|
|
|
|
|
``profile/cpu`` allows you to profile a bit of code.
|
|
|
|
|
|
|
|
Usage: `(profile/cpu (body))`
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
.. code-block:: hy
|
|
|
|
|
|
|
|
(require [hy.contrib.profile [profile/cpu]])
|
|
|
|
(profile/cpu (print "hey there"))
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
hey there
|
|
|
|
<pstats.Stats instance at 0x14ff320>
|
|
|
|
2 function calls in 0.000 seconds
|
2018-05-16 05:29:07 +02:00
|
|
|
|
2016-12-19 06:10:24 +01:00
|
|
|
Random listing order was used
|
2018-05-16 05:29:07 +02:00
|
|
|
|
2016-12-19 06:10:24 +01:00
|
|
|
ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
|
|
|
|
1 0.000 0.000 0.000 0.000 {print}
|