~hopem/charms/trusty/neutron-openvswitch/lp1497517

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/cli/benchmark.py

  • Committer: Liam Young
  • Date: 2015-07-31 13:11:50 UTC
  • Revision ID: liam.young@canonical.com-20150731131150-yn26ia5o8jff118v
[gnuoy,trivial] Pre-release charmhelper sync to pickup cli module

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2014-2015 Canonical Limited.
 
2
#
 
3
# This file is part of charm-helpers.
 
4
#
 
5
# charm-helpers is free software: you can redistribute it and/or modify
 
6
# it under the terms of the GNU Lesser General Public License version 3 as
 
7
# published by the Free Software Foundation.
 
8
#
 
9
# charm-helpers is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU Lesser General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU Lesser General Public License
 
15
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
 
17
from . import cmdline
 
18
from charmhelpers.contrib.benchmark import Benchmark
 
19
 
 
20
 
 
21
@cmdline.subcommand(command_name='benchmark-start')
 
22
def start():
 
23
    Benchmark.start()
 
24
 
 
25
 
 
26
@cmdline.subcommand(command_name='benchmark-finish')
 
27
def finish():
 
28
    Benchmark.finish()
 
29
 
 
30
 
 
31
@cmdline.subcommand_builder('benchmark-composite', description="Set the benchmark composite score")
 
32
def service(subparser):
 
33
    subparser.add_argument("value", help="The composite score.")
 
34
    subparser.add_argument("units", help="The units the composite score represents, i.e., 'reads/sec'.")
 
35
    subparser.add_argument("direction", help="'asc' if a lower score is better, 'desc' if a higher score is better.")
 
36
    return Benchmark.set_composite_score