Path: blob/main/tools/parse_baselines/providers/block.py
1958 views
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.1# SPDX-License-Identifier: Apache-2.02"""Implement the DataParser for block device performance tests."""34import statistics5import math6from collections import Iterator7from typing import List8from providers.types import DataParser910# We add a small extra percentage margin, to account for small variations11# that were not caught while gathering baselines. This provides12# slightly better reliability, while not affecting regression13# detection.14DELTA_EXTRA_MARGIN = 4151617# pylint: disable=R090318class BlockDataParser(DataParser):19"""Parse the data provided by the block performance tests."""2021# pylint: disable=W010222def __init__(self, data_provider: Iterator):23"""Initialize the data parser."""24super().__init__(data_provider, [25"iops_read/Avg",26"iops_write/Avg",27"bw_read/Avg",28"bw_write/Avg",29"cpu_utilization_vcpus_total/Avg",30"cpu_utilization_vmm/Avg",31])3233# pylint: disable=R020134def calculate_baseline(self, data: List[float]) -> dict:35"""Return the target and delta values, given a list of data points."""36avg = statistics.mean(data)37stddev = statistics.stdev(data)38return {39'target': math.ceil(round(avg, 2)),40'delta_percentage':41math.ceil(3 * stddev/avg * 100) + DELTA_EXTRA_MARGIN42}434445