From 7e8b871b07c1afff6bcfe2e218c88ab1463ecfe5 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 9 Mar 2009 18:07:10 +0000 Subject: bcfg2-info: add option trace file option for profiling mode git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5113 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Options.py | 2 +- src/sbin/bcfg2-info | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/lib/Options.py b/src/lib/Options.py index b497c138f..8f3df5f39 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -220,7 +220,7 @@ CLIENT_EXTRA_DISPLAY = Option('enable extra entry output', default=False, cmd='-e', ) CLIENT_PARANOID = Option('make automatic backups of config files', default=False, cmd='-P', ) -CORE_PROFILE = Option('profile server core', +CORE_PROFILE = Option('profile server core', odesc='', default=False, cmd='-p', ) CLIENT_AGENT = Option('run in agent (continuous) mode, wait for reconfigure command from server', default=False, cmd='-A', ) CLIENT_DRIVERS = Option('Specify tool driver set', cmd='-D', diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 72e6c42e0..4f7228c8e 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -2,7 +2,7 @@ '''This tool loads the Bcfg2 core into an interactive debugger''' __revision__ = '$Revision$' -import copy, logging, lxml.etree, sys, cmd, tempfile +import copy, logging, lxml.etree, sys, cmd import Bcfg2.Logger, Bcfg2.Server.Core, os import Bcfg2.Server.Plugins.Metadata, Bcfg2.Server.Plugin import Bcfg2.Options @@ -317,15 +317,13 @@ if __name__ == '__main__': '-d' in sys.argv, []) else: import hotshot, hotshot.stats - pfd, pfile = tempfile.mkstemp() - prof = hotshot.Profile(pfile) + prof = hotshot.Profile(setup['profile']) try: prof.runcall(main, setup['repo'], setup['plugins'], setup['password'], setup['encoding'], '-d' in sys.argv, ['exit']) except SystemExit: - stats = hotshot.stats.load(pfile) + stats = hotshot.stats.load(setup['profile']) stats.strip_dirs() stats.sort_stats('time', 'calls') stats.print_stats(80) - print pfile raise -- cgit v1.2.3-1-g7c22