mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-08 11:59:48 -04:00
chore: update query.py
to handle releases correctly
This commit is contained in:
parent
794bcd4cad
commit
8cdc0e7698
@ -56,29 +56,64 @@ def import_data(db_path, *args):
|
|||||||
def walltime_chart(db_path, arch, binary_type, version, exclude):
|
def walltime_chart(db_path, arch, binary_type, version, exclude):
|
||||||
db = TinyDB(db_path)
|
db = TinyDB(db_path)
|
||||||
table = db.table(TABLE_NAME)
|
table = db.table(TABLE_NAME)
|
||||||
Q = Query()
|
|
||||||
|
|
||||||
release_configs = {
|
# Release configurations before 0.12.0
|
||||||
None,
|
release_configs_old = {
|
||||||
"clang",
|
k: {None, "clang"} for k in ("standalone", "universal", "fuse-extract")
|
||||||
"clang-minsize-musl-lto",
|
}
|
||||||
|
|
||||||
|
release_configs_by_version = {
|
||||||
|
"0.12.0": {
|
||||||
|
"standalone": {"clang-minsize-musl-lto"},
|
||||||
|
"universal": {"clang-minsize-musl-lto"},
|
||||||
|
"fuse-extract": {"clang-minsize-musl-minimal-lto"},
|
||||||
|
},
|
||||||
|
"0.12.1": {
|
||||||
|
"standalone": {"clang-minsize-musl-mimalloc-lto"},
|
||||||
|
"universal": {"clang-minsize-musl-mimalloc-lto"},
|
||||||
|
"fuse-extract": {"clang-minsize-musl-minimal-mimalloc-lto"},
|
||||||
|
},
|
||||||
|
"0.12.2": {
|
||||||
|
"standalone": {"clang-minsize-musl-lto"},
|
||||||
|
"universal": {"clang-minsize-musl-lto"},
|
||||||
|
"fuse-extract": {"clang-minsize-musl-minimal-lto"},
|
||||||
|
},
|
||||||
|
"0.12.3": {
|
||||||
|
"standalone": {"clang-minsize-musl-lto"},
|
||||||
|
"universal": {"clang-minsize-musl-libressl-lto"},
|
||||||
|
"fuse-extract": {"clang-minsize-musl-minimal-lto"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
exclude_re = re.compile(exclude) if exclude else None
|
exclude_re = re.compile(exclude) if exclude else None
|
||||||
|
|
||||||
# Fetch rows that match the arch, binary_type etc.
|
def include_config(qconfig, qversion):
|
||||||
rows = table.search(
|
s = release_configs_by_version.get(qversion, release_configs_old).get(
|
||||||
(Q.arch == arch)
|
binary_type
|
||||||
& (Q.type == binary_type)
|
|
||||||
& (Q.mean.exists())
|
|
||||||
& (Q.stddev.exists())
|
|
||||||
& (
|
|
||||||
Q.config.test(lambda x: x in release_configs)
|
|
||||||
if version is None
|
|
||||||
else Q.version == version
|
|
||||||
)
|
)
|
||||||
& (Q.name.test(lambda x: exclude_re is None or not exclude_re.search(x)))
|
# print(f"include_config: {qconfig} {qversion} {s}")
|
||||||
)
|
return qconfig in s
|
||||||
|
|
||||||
|
def query(doc):
|
||||||
|
if doc["arch"] != arch:
|
||||||
|
return False
|
||||||
|
if doc["type"] != binary_type:
|
||||||
|
return False
|
||||||
|
if "mean" not in doc:
|
||||||
|
return False
|
||||||
|
if "stddev" not in doc:
|
||||||
|
return False
|
||||||
|
if exclude_re and exclude_re.search(doc["name"]):
|
||||||
|
return False
|
||||||
|
if version is None:
|
||||||
|
if not include_config(doc["config"], doc["version"]):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if doc["version"] != version:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
rows = table.search(lambda doc: query(doc))
|
||||||
|
|
||||||
# Sort and create a DataFrame with the relevant columns.
|
# Sort and create a DataFrame with the relevant columns.
|
||||||
# rows.sort(key=lambda r: (r.get("name"), r.get("config")))
|
# rows.sort(key=lambda r: (r.get("name"), r.get("config")))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user