aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeongJae Park <sj38.park@gmail.com>2024-03-03 11:24:36 -0800
committerSeongJae Park <sj38.park@gmail.com>2024-03-03 11:24:36 -0800
commit5f52fc9f83144ce5c7c2280886ce11dfafbf88d6 (patch)
tree825dd2411b4000c6fad4b4e76c7c2d330945a6ad
parentee8ee95af1b79b6b766fd4660e98d7140ee81078 (diff)
downloaddamo-5f52fc9f83144ce5c7c2280886ce11dfafbf88d6.tar.gz
_damon_records: Implement snapshot size filtering function
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r--_damon_records.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/_damon_records.py b/_damon_records.py
index 758257c5..88f2a7fd 100644
--- a/_damon_records.py
+++ b/_damon_records.py
@@ -824,6 +824,17 @@ def filter_records_by_addr(records, addr_ranges):
snapshot.regions = filtered_regions
snapshot.update_total_bytes()
+def filter_records_by_snapshot_sz(records, sz_ranges):
+ for record in records:
+ filtered_snapshots = []
+ for snapshot in record.snapshots:
+ for min_, max_ in sz_ranges:
+ if (min_ <= snapshot.total_bytes and
+ snapshot.total_bytes <= max_):
+ filtered_snapshots.append(snapshot)
+ break
+ record.snapshots = filtered_snapshots
+
def get_snapshot_records_of(request):
'''
get records containing single snapshot from running kdamonds