From c5b5b30cb781b3fceaa5905bd839ea501cf281b5 Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Mon, 2 Apr 2018 16:29:11 +0800 Subject: [PATCH] tools/cachetop: match bpf.ksym() with bytes arrays bpf.ksym() now returns a bytes array, and python3 would issue TypeError when matching the string. Signed-off-by: Gary Lin --- tools/cachetop.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/cachetop.py b/tools/cachetop.py index 47404d3607b0..076300886bce 100755 --- a/tools/cachetop.py +++ b/tools/cachetop.py @@ -88,16 +88,16 @@ def get_processes_stats( whits = 0 for k, v in count.items(): - if re.match('mark_page_accessed', bpf.ksym(k)) is not None: + if re.match(b'mark_page_accessed', bpf.ksym(k)) is not None: mpa = max(0, v) - if re.match('mark_buffer_dirty', bpf.ksym(k)) is not None: + if re.match(b'mark_buffer_dirty', bpf.ksym(k)) is not None: mbd = max(0, v) - if re.match('add_to_page_cache_lru', bpf.ksym(k)) is not None: + if re.match(b'add_to_page_cache_lru', bpf.ksym(k)) is not None: apcl = max(0, v) - if re.match('account_page_dirtied', bpf.ksym(k)) is not None: + if re.match(b'account_page_dirtied', bpf.ksym(k)) is not None: apd = max(0, v) # access = total cache access incl. reads(mpa) and writes(mbd)