6
6
import logging
7
7
import json
8
8
import shutil
9
+ import platform
9
10
10
- import pytest
11
11
from framework import utils
12
- from framework .utils_cpuid import CpuVendor , get_cpu_vendor
13
12
from framework .defs import FC_WORKSPACE_DIR
14
13
from host_tools import proc
15
14
16
15
BENCHMARK_DIRECTORY = "{}/src/vmm" .format (FC_WORKSPACE_DIR )
16
+ DEFAULT_BUILD_TARGET = "{}-unknown-linux-musl" .format (platform .machine ())
17
17
18
18
PROC_MODEL = proc .proc_type ()
19
19
27
27
},
28
28
"deserialize" : {
29
29
"no-crc" : {"target" : 0.034 , "delta" : 0.015 }, # milliseconds # milliseconds
30
- "crc" : {"target" : 0.042 , "delta" : 0.015 }, # milliseconds # milliseconds
30
+ "crc" : {"target" : 0.042 , "delta" : 0.020 }, # milliseconds # milliseconds
31
31
},
32
32
},
33
33
"AMD" : {
34
34
"serialize" : {
35
- "no-crc" : {"target" : 0.096 , "delta" : 0.025 }, # milliseconds # milliseconds
36
- "crc" : {"target" : 0.122 , "delta" : 0.025 }, # milliseconds # milliseconds
35
+ "no-crc" : {"target" : 0.084 , "delta" : 0.05 }, # milliseconds # milliseconds
36
+ "crc" : {"target" : 0.108 , "delta" : 0.025 }, # milliseconds # milliseconds
37
37
},
38
38
"deserialize" : {
39
- "no-crc" : {"target" : 0.037 , "delta" : 0.015 }, # milliseconds # milliseconds
40
- "crc" : {"target" : 0.045 , "delta" : 0.015 }, # milliseconds # milliseconds
39
+ "no-crc" : {"target" : 0.070 , "delta" : 0.02 }, # milliseconds # milliseconds
40
+ "crc" : {"target" : 0.052 , "delta" : 0.04 }, # milliseconds # milliseconds
41
41
},
42
42
},
43
43
"ARM" : {
44
44
"serialize" : {
45
- "no-crc" : {"target" : 0.096 , "delta" : 0.025 }, # milliseconds # milliseconds
46
- "crc" : {"target" : 0.186 , "delta" : 0.025 }, # milliseconds # milliseconds
45
+ "no-crc" : {"target" : 0.05 , "delta" : 0.02 }, # milliseconds # milliseconds
46
+ "crc" : {"target" : 0.054 , "delta" : 0.02 }, # milliseconds # milliseconds
47
47
},
48
48
"deserialize" : {
49
- "no-crc" : {"target" : 0.034 , "delta" : 0.015 }, # milliseconds # milliseconds
50
- "crc" : {"target" : 0.042 , "delta" : 0.015 }, # milliseconds # milliseconds
49
+ "no-crc" : {"target" : 0.057 , "delta" : 0.02 }, # milliseconds # milliseconds
50
+ "crc" : {"target" : 0.063 , "delta" : 0.02 }, # milliseconds # milliseconds
51
51
},
52
52
},
53
53
}
@@ -75,7 +75,6 @@ def _check_statistics(directory, mean):
75
75
return directory , f"{ mean } ms" , f"{ low } <= result <= { high } "
76
76
77
77
78
- @pytest .mark .skipif (get_cpu_vendor () != CpuVendor .INTEL , reason = "Not supported yet." )
79
78
def test_serialization_benchmark ():
80
79
"""
81
80
Benchmark test for MicrovmState serialization/deserialization.
@@ -88,7 +87,7 @@ def test_serialization_benchmark():
88
87
os .chdir (BENCHMARK_DIRECTORY )
89
88
90
89
# Run benchmark test
91
- cmd = "cargo bench"
90
+ cmd = "cargo bench --target {}" . format ( DEFAULT_BUILD_TARGET )
92
91
result = utils .run_cmd_sync (cmd )
93
92
assert result .returncode == 0
94
93
@@ -115,7 +114,7 @@ def test_serialization_benchmark():
115
114
mean = estimates ["mean" ]["point_estimate" ] / NSEC_IN_MSEC
116
115
logger .info ("Mean: %f" , mean )
117
116
118
- res = _check_statistics (directory , mean )
117
+ res = _check_statistics (directory , round ( mean , 3 ) )
119
118
120
119
results_and_criteria [0 ] += f"{ res [0 ]} : { res [1 ]} , "
121
120
results_and_criteria [1 ] += f"{ res [0 ]} : { res [2 ]} , "
0 commit comments