From 067d475dbba8fd0b471a26cedc1e05309fe4e67c Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Mon, 15 Jul 2019 10:47:33 -0500 Subject: scripts/buildstats-diff: Add option to filter tasks Adds a command line option to filter out the buildstats-diff report by one more more tasks. e.g.: buildstats-diff --only-task do_compile A B will only show the differences for do_compile tasks. The --only-task option can be specified multiple times to filter out multiple tasks at once. (From OE-Core rev: a8c7960d24c48107fd3703e49c38f890e84e2226) Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- scripts/lib/buildstats.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts/lib') diff --git a/scripts/lib/buildstats.py b/scripts/lib/buildstats.py index 1adab06edf..c69b5bf4d7 100644 --- a/scripts/lib/buildstats.py +++ b/scripts/lib/buildstats.py @@ -261,13 +261,17 @@ class BuildStats(dict): self[pkg].aggregate(data) -def diff_buildstats(bs1, bs2, stat_attr, min_val=None, min_absdiff=None): +def diff_buildstats(bs1, bs2, stat_attr, min_val=None, min_absdiff=None, only_tasks=[]): """Compare the tasks of two buildstats""" tasks_diff = [] pkgs = set(bs1.keys()).union(set(bs2.keys())) for pkg in pkgs: tasks1 = bs1[pkg].tasks if pkg in bs1 else {} tasks2 = bs2[pkg].tasks if pkg in bs2 else {} + if only_tasks: + tasks1 = {k: v for k, v in tasks1.items() if k in only_tasks} + tasks2 = {k: v for k, v in tasks2.items() if k in only_tasks} + if not tasks1: pkg_op = '+' elif not tasks2: -- cgit v1.2.3-54-g00ecf