summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2011-12-28 14:34:13 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2011-12-28 14:34:13 -0500
commit6a9e492eaaca81609e7dd149a660bb24e119572c (patch)
treea2ab5a1d8d465e723f8e0c5fd81aaeb0d9882247 /tools
parent4b44aab4ed8ef39b15ea4f7a1ebb648ec95642fb (diff)
downloadbcfg2-6a9e492eaaca81609e7dd149a660bb24e119572c.tar.gz
bcfg2-6a9e492eaaca81609e7dd149a660bb24e119572c.tar.bz2
bcfg2-6a9e492eaaca81609e7dd149a660bb24e119572c.zip
added --client argument to bcfg2-profile-templates.py
Diffstat (limited to 'tools')
-rwxr-xr-xtools/bcfg2-profile-templates.py35
1 files changed, 23 insertions, 12 deletions
diff --git a/tools/bcfg2-profile-templates.py b/tools/bcfg2-profile-templates.py
index eba84d02d..1cecc0274 100755
--- a/tools/bcfg2-profile-templates.py
+++ b/tools/bcfg2-profile-templates.py
@@ -35,14 +35,21 @@ def get_logger(setup=None):
return LOGGER
def main():
- optinfo = dict(configfile=Bcfg2.Options.CFILE,
- help=Bcfg2.Options.HELP,
- encoding=Bcfg2.Options.ENCODING,
- repo=Bcfg2.Options.SERVER_REPOSITORY,
- plugins=Bcfg2.Options.SERVER_PLUGINS,
- password=Bcfg2.Options.SERVER_PASSWORD,
- debug=Bcfg2.Options.DEBUG,
- verbose=Bcfg2.Options.VERBOSE)
+ optinfo = \
+ dict(configfile=Bcfg2.Options.CFILE,
+ help=Bcfg2.Options.HELP,
+ encoding=Bcfg2.Options.ENCODING,
+ repo=Bcfg2.Options.SERVER_REPOSITORY,
+ plugins=Bcfg2.Options.SERVER_PLUGINS,
+ password=Bcfg2.Options.SERVER_PASSWORD,
+ debug=Bcfg2.Options.DEBUG,
+ verbose=Bcfg2.Options.VERBOSE,
+ client=Bcfg2.Options.Option("Benchmark templates for one client",
+ cmd="--client",
+ odesc="<client>",
+ long_arg=True,
+ default=None),
+ )
setup = Bcfg2.Options.OptionParser(optinfo)
setup.parse(sys.argv[1:])
logger = get_logger(setup)
@@ -63,6 +70,11 @@ def main():
else:
templates = []
+ if setup['client'] is None:
+ clients = [core.build_metadata(c) for c in core.metadata.clients]
+ else:
+ clients = [core.build_metadata(setup['client'])]
+
times = dict()
for plugin in ['Cfg', 'TGenshi', 'TCheetah']:
if plugin not in core.plugins:
@@ -85,9 +97,8 @@ def main():
path = eset.path.replace(setup['repo'], '')
logger.info("Rendering %s..." % path)
times[path] = dict()
- for client in core.metadata.clients:
+ for metadata in clients:
avg = 0.0
- metadata = core.build_metadata(client)
for i in range(runs):
entry = lxml.etree.Element("Path")
start = time.time()
@@ -97,8 +108,8 @@ def main():
except:
break
if avg:
- logger.debug(" %s: %.02f sec" % (client, avg))
- times[path][client] = avg
+ logger.debug(" %s: %.02f sec" % (metadata.hostname, avg))
+ times[path][metadata.hostname] = avg
# print out per-template results
tmpltimes = []