diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-11-21 11:13:15 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-11-21 11:15:24 +0100 |
commit | 010b732a89352993eda688f2352375464fd712e3 (patch) | |
tree | a3452f1080cb143f30d83a2ffd102e7eed47d646 /membench.py | |
parent | 07aaa327e54123c2c9852a650fd9db598c3dc11a (diff) |
membench: Support variant comparison
Diffstat (limited to 'membench.py')
-rwxr-xr-x | membench.py | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/membench.py b/membench.py index a8e3b4c0..87a513e6 100755 --- a/membench.py +++ b/membench.py @@ -26,30 +26,57 @@ # POSSIBILITY OF SUCH DAMAGE. import sys +from typing import Dict, List, Optional -from rtemsspec.items import ItemCache, item_is_enabled -from rtemsspec.membench import generate +from rtemsspec.items import ItemCache +from rtemsspec.membench import gather_sections, generate, \ + generate_variants_table, MembenchVariant, SectionsByUID from rtemsspec.sphinxcontent import SphinxContent, SphinxMapper from rtemsspec.util import create_argument_parser, init_logging, load_config +def _split(value: Optional[str]) -> List[str]: + return value.split(",") if value else [] + + def main() -> None: """ Generates a memory benchmark report. """ parser = create_argument_parser() parser.add_argument( "builddir", metavar="BUILDDIR", - nargs=1, + nargs="+", help="the build directory containing the memory benchmark executables") + parser.add_argument( + "--enabled", + help=("a comma separated list of enabled options used to evaluate " + "enabled-by expressions")) + parser.add_argument("--variants", + help="a comma separated list of variant names") args = parser.parse_args(sys.argv[1:]) init_logging(args) - config = load_config("config.yml") - item_cache = ItemCache(config["spec"]) - item_cache.set_enabled([], item_is_enabled) + config = load_config("config.yml")["spec"] + config["enabled"] = _split(args.enabled) + item_cache = ItemCache(config) content = SphinxContent() root = item_cache["/rtems/req/mem-basic"] - table_pivots = ["/rtems/req/mem-basic", "/rtems/req/mem-smp-1"] - generate(content, root, SphinxMapper(root), table_pivots, args.builddir[0]) + table_pivots = ["/rtems/req/mem-smp-1"] + if len(args.builddir) == 1: + sections_by_uid = gather_sections(item_cache, args.builddir[0], + "objdump", "gdb") + generate(content, sections_by_uid, root, table_pivots, + SphinxMapper(root)) + else: + names = _split(args.variants) + assert len(names) == len(args.builddir) + sections_by_build_label: Dict[str, Dict[str, SectionsByUID]] = {} + variants: List[MembenchVariant] = [] + for name, builddir in zip(names, args.builddir): + sections_by_build_label[name]["membench"] = gather_sections( + item_cache, builddir, "objdump", "gdb") + variants.append(MembenchVariant(name, name)) + generate_variants_table(content, sections_by_build_label, root, + variants) print(str(content)) |