Skip to content

Commit 01f0970

Browse files
dianpopabchalios
authored andcommitted
enable baselines parsing for network latency
Signed-off-by: Diana Popa <[email protected]>
1 parent de0e081 commit 01f0970

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

tests/integration_tests/performance/test_network_latency.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def test_network_latency(bin_cloner_path, results_file_dumper):
139139
kernel_artifacts = ArtifactSet(ARTIFACTS_COLLECTION.kernels())
140140
disk_artifacts = ArtifactSet(ARTIFACTS_COLLECTION.disks(keyword="ubuntu"))
141141

142+
logger.info("Testing on processor %s", get_cpu_model_name())
143+
142144
# Create a test context and add builder, logger, network.
143145
test_context = TestContext()
144146
test_context.custom = {

tools/parse_baselines/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from providers.iperf3 import Iperf3DataParser
1818
from providers.block import BlockDataParser
1919
from providers.snapshot_restore import SnapshotRestoreDataParser
20+
from providers.latency import LatencyDataParser
2021

2122
sys.path.append(os.path.join(os.getcwd(), "tests"))
2223

@@ -30,13 +31,15 @@
3031
"test_block_performance_async",
3132
],
3233
"snapshot_restore_performance": ["test_snap_restore_performance"],
34+
"network_latency": ["test_network_latency"],
3335
}
3436

3537
DATA_PARSERS = {
3638
"vsock_throughput": Iperf3DataParser,
3739
"network_tcp_throughput": Iperf3DataParser,
3840
"block_performance": BlockDataParser,
3941
"snapshot_restore_performance": SnapshotRestoreDataParser,
42+
"network_latency": LatencyDataParser,
4043
}
4144

4245

@@ -67,8 +70,9 @@ def concatenate_data_files(data_files: List[str]):
6770

6871
for filename in data_files:
6972
with open(filename, encoding="utf-8") as infile:
70-
outfile.write(str.encode(infile.read()))
71-
73+
contents = str.encode(infile.read())
74+
outfile.write(contents)
75+
outfile.flush()
7276
return outfile
7377

7478

@@ -98,6 +102,7 @@ def main():
98102
choices=[
99103
"vsock_throughput",
100104
"network_tcp_throughput",
105+
"network_latency",
101106
"block_performance",
102107
"snapshot_restore_performance",
103108
],
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
"""Implement the DataParser for network latency performance tests."""
4+
5+
import statistics
6+
from collections.abc import Iterator
7+
from typing import List
8+
from providers.types import DataParser
9+
10+
# We add a small extra percentage margin, to account for small variations
11+
# that were not caught while gathering baselines. This provides
12+
# slightly better reliability, while not affecting regression
13+
# detection.
14+
DELTA_EXTRA_MARGIN = 0.01
15+
16+
17+
# pylint: disable=R0903
18+
class LatencyDataParser(DataParser):
19+
"""Parse the data provided by the network latency performance tests."""
20+
21+
# pylint: disable=W0102
22+
def __init__(self, data_provider: Iterator):
23+
"""Initialize the data parser."""
24+
super().__init__(
25+
data_provider,
26+
["latency/Avg"],
27+
)
28+
29+
def calculate_baseline(self, data: List[float]) -> dict:
30+
"""Return the target and delta values, given a list of data points."""
31+
avg = statistics.mean(data)
32+
stddev = statistics.stdev(data)
33+
return {
34+
"target": round(avg, 3),
35+
"delta_percentage": round(stddev + DELTA_EXTRA_MARGIN, 2),
36+
}

0 commit comments

Comments
 (0)