From 115b7dd5fa2e5cefd3931deeec77fc7a7a8b7048 Mon Sep 17 00:00:00 2001 From: accraze Date: Sun, 18 Dec 2016 21:10:24 -0800 Subject: [PATCH 1/2] Added contrib.profile docs fixes #1145 --- docs/contrib/index.rst | 1 + docs/contrib/profile.rst | 57 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 docs/contrib/profile.rst diff --git a/docs/contrib/index.rst b/docs/contrib/index.rst index 5ddac2a..cb881c5 100644 --- a/docs/contrib/index.rst +++ b/docs/contrib/index.rst @@ -12,5 +12,6 @@ Contents: flow loop multi + profile sequences walk diff --git a/docs/contrib/profile.rst b/docs/contrib/profile.rst new file mode 100644 index 0000000..f2abafa --- /dev/null +++ b/docs/contrib/profile.rst @@ -0,0 +1,57 @@ +========== +Profile +========== + +.. versionadded:: 0.10.0 + +The ``profile`` macros make debugging where bottlenecks exist easier.. + + +Macros +====== + +.. _profile/calls: +.. _profile/cpu: + +profile/calls +-------------- + +``profile/calls`` allows you to create a call graph visualization. +**Note:** You must have `Graphviz `_ +installed for this to work. + + +Usage: `(profile/calls (body))` + +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 + + 2 function calls in 0.000 seconds + + Random listing order was used + + 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} From 664ded1a19238c669249f469e91ae3c381103b62 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Mon, 19 Dec 2016 14:44:16 -0800 Subject: [PATCH 2/2] profile docs wording edit --- docs/contrib/profile.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contrib/profile.rst b/docs/contrib/profile.rst index f2abafa..6edbd34 100644 --- a/docs/contrib/profile.rst +++ b/docs/contrib/profile.rst @@ -4,7 +4,7 @@ Profile .. versionadded:: 0.10.0 -The ``profile`` macros make debugging where bottlenecks exist easier.. +The ``profile`` macros make it easier to find bottlenecks. Macros