rally-openstack/rally-jobs/plugins/rally_profile.py
Anton Studenov e0fa9c1910 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
2016-10-26 17:45:12 +03:00

33 lines
1.2 KiB
Python

# 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()