summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalen Pennington <cpennington@wgen.net>2011-09-09 17:33:13 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-01-13 11:49:42 -0500
commit56292eaac58c78a7e89d3c264b13b348e5d65a8f (patch)
treefc6dfb099b415e9963fbb0fcb21249b0b9cc3243
parentb3bb4a985fa23305f79c9eb390bcfda4db5069f5 (diff)
downloadbcfg2-56292eaac58c78a7e89d3c264b13b348e5d65a8f.tar.gz
bcfg2-56292eaac58c78a7e89d3c264b13b348e5d65a8f.tar.bz2
bcfg2-56292eaac58c78a7e89d3c264b13b348e5d65a8f.zip
Use cProfile if available, otherwise use standard python profile
cProfile, when available (python >= 2.5), gives enhanced profiling of c calls (and has a lower overhead). This means it's possible to find things like socket.gethostbyname that might be eating up large amounts of time (without showing up in the standard profile reports).
-rwxr-xr-xsrc/sbin/bcfg2-info5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index de4e95102..31b9ba0c6 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -14,7 +14,10 @@ import sys
import tempfile
try:
- import profile
+ try:
+ import cProfile as profile
+ except:
+ import profile
import pstats
have_profile = True
except: