From c0a654e6cb58df75cd973cd04da50cee39daa36a Mon Sep 17 00:00:00 2001 From: Paul Tagliamonte Date: Fri, 10 Jan 2014 21:02:14 -0500 Subject: [PATCH] Add callgraph stuff. Slick look. --- hy/contrib/profile.hy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hy/contrib/profile.hy b/hy/contrib/profile.hy index 3992890..485f46b 100644 --- a/hy/contrib/profile.hy +++ b/hy/contrib/profile.hy @@ -23,7 +23,15 @@ ;;; These macros make debugging where bottlenecks exist easier. -(defmacro/g! profile [&rest body] +(defmacro profile/calls [&rest body] + `(do + (import [pycallgraph [PyCallGraph]] + [pycallgraph.output [GraphvizOutput]]) + (with* [(apply PyCallGraph [] {"output" (GraphvizOutput)})] + ~@body))) + + +(defmacro/g! profile/cpu [&rest body] " Profile a bit of code " `(do (import cProfile pstats)