Benchmark for generate_random_name

This patch adds scenario that runs generate_random_name
in atomic and shows performance of this method.

Change-Id: Iff2445f2d5c295a06bd2e72874280ecb1c4280f2
This commit is contained in:
Anton Studenov 2016-10-26 17:45:12 +03:00
parent c08bd2b1c8
commit e3abaac69f
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,32 @@
# Copyright 2016: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from rally.common import utils
from rally.task import atomic
from rally.task import scenario
@scenario.configure(name="RallyProfile.generate_names_in_atomic")
class GenerateNamesInAtomic(scenario.Scenario, utils.RandomNameGeneratorMixin):
def run(self, number_of_names):
"""Generate random names in atomic.
:param number_of_names: int number of names to create
"""
with atomic.ActionTimer(self, "generate_%s_names" % number_of_names):
for i in range(number_of_names):
self.generate_random_name()

View File

@ -794,6 +794,38 @@
failure_rate:
max: 0
RallyProfile.generate_names_in_atomic:
-
args:
number_of_names: 100
runner:
type: "constant"
times: 10
concurrency: 5
sla:
failure_rate:
max: 0
-
args:
number_of_names: 1000
runner:
type: "constant"
times: 10
concurrency: 5
sla:
failure_rate:
max: 0
-
args:
number_of_names: 10000
runner:
type: "constant"
times: 10
concurrency: 5
sla:
failure_rate:
max: 0
CeilometerStats.get_stats:
-
runner: