mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 11:41:35 +01:00
bench-boot: continue progress, renamte to test-boot
This commit is contained in:
101
test-boot
Executable file
101
test-boot
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import common
|
||||
from shell_helpers import LF
|
||||
|
||||
class Main(common.LkmcCliFunction):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
defaults={
|
||||
'print_time': False,
|
||||
},
|
||||
description='''\
|
||||
Run Linux kernel boot tests and benchmarks.
|
||||
'''
|
||||
)
|
||||
self.add_argument(
|
||||
'--size',
|
||||
default=1,
|
||||
type=int,
|
||||
help='''\
|
||||
Size of the tests to run. Scale:
|
||||
|
||||
* 1: a few seconds and important
|
||||
* 2: < 5 minutes and important or a few seconds and not too important
|
||||
* 3: all
|
||||
'''
|
||||
)
|
||||
|
||||
def _bench(self, **kwargs):
|
||||
self.run(**kwargs)
|
||||
|
||||
def timed_main(self):
|
||||
# TODO bring this benchmark code back to life. Likely should go inside run with an option
|
||||
#
|
||||
#bench() (
|
||||
# "${root_dir}/bench-cmd" "./run --arch ${1}${extra_args}" "$self.env['test_boot_benchmark_file']"
|
||||
#)
|
||||
#
|
||||
#newline() (
|
||||
# echo >> "$self.env['test_boot_benchmark_file']"
|
||||
#)
|
||||
#
|
||||
#gem5_insts() (
|
||||
# printf "instructions $(./gem5-stat --arch "$1" sim_insts)\n" >> "$self.env['test_boot_benchmark_file']"
|
||||
# newline
|
||||
#)
|
||||
#
|
||||
#qemu_insts() (
|
||||
# common_arch="$1"
|
||||
# ./qemu-trace2txt --arch "$common_arch"
|
||||
# common_qemu_trace_txt_file="$("$getvar" --arch "$common_arch" qemu_trace_txt_file)"
|
||||
# printf "instructions $(wc -l "${common_qemu_trace_txt_file}" | cut -d' ' -f1)\n" >> "$self.env['test_boot_benchmark_file']"
|
||||
# newline
|
||||
#)
|
||||
#
|
||||
#rm -f "${self.env['test_boot_benchmark_file']}"
|
||||
self.run = self.import_path_main('run')
|
||||
run_args = self.get_common_args()
|
||||
if self.env['emulator'] == 'gem5':
|
||||
run_args['eval'] = 'm5 exit'
|
||||
elif self.env['emulator'] == 'qemu':
|
||||
run_args['eval'] = '/poweroff.out'
|
||||
if (self.env['emulator'] == 'qemu' or
|
||||
(self.env['emulator'] == 'gem5' and self.env['size'] >= 2)):
|
||||
self._bench(**run_args)
|
||||
if self.env['host_arch'] == self.env['arch']:
|
||||
# TODO: find out why it fails.
|
||||
if self.env['emulator'] != 'gem5':
|
||||
self._bench(kvm=True, **run_args)
|
||||
if self.env['emulator'] == 'qemu' and self.env['size'] >= 2:
|
||||
self._bench(trace='exec_tb', **run_args)
|
||||
if self.env['emulator'] == 'gem5' and self.env['size'] >= 3:
|
||||
if self.env['arch'] == 'x86_64':
|
||||
cpu_types = ['DerivO3CPU']
|
||||
elif self.env['is_arm']:
|
||||
cpu_types = [
|
||||
'DerivO3CPU',
|
||||
'HPI',
|
||||
]
|
||||
for cpu_type in cpu_types:
|
||||
self._bench(
|
||||
extra_emulator_args=[
|
||||
'--cpu-type', cpu_type,
|
||||
'--caches',
|
||||
'--l2cache',
|
||||
'--l1d_size=1024kB',
|
||||
'--l1i_size=1024kB',
|
||||
'--l2_size=1024kB',
|
||||
'--l3_size=1024kB',
|
||||
],
|
||||
**run_args
|
||||
)
|
||||
if self.env['arch'] == 'aarch64':
|
||||
# Do a fuller testing for aarch64.
|
||||
for build_type in ['debug', 'fast']:
|
||||
self._bench(gem5_build_type=build_type, **run_args)
|
||||
self._bench(gem5_script='biglittle', **run_args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
Main().cli_exit()
|
||||
|
||||
Reference in New Issue
Block a user