From 0c6ba4bbe3f92dc696d00a8066457ee8e4222c98 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Tue, 15 Jul 2014 19:11:18 +0400 Subject: [PATCH] Add daemon mode to benchmark Change-Id: I9dbd71abc9cb7cca75582910be0eeefc27a1a174 --- benchmark/benchmark.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index f671500..b661974 100644 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -22,6 +22,8 @@ import subprocess import sys import timeit +from oslo.rootwrap import client + config_path = "rootwrap.conf" num_iterations = 100 @@ -45,6 +47,11 @@ def run_rootwrap(cmd): "from oslo.rootwrap import cmd; cmd.main()", config_path] + cmd) +run_daemon = client.Client([ + "sudo", sys.executable, "-c", + "from oslo.rootwrap import cmd; cmd.daemon()", config_path]).execute + + def run_one(runner, cmd): def __inner(): code, out, err = runner(cmd) @@ -56,6 +63,7 @@ runners = [ ("{0}", run_plain), ("sudo {0}", run_sudo), ("sudo rootwrap conf {0}", run_rootwrap), + ("daemon.run('{0}')", run_daemon), ]