Skip to content

Commit

Permalink
tools/cachetop: match bpf.ksym() with bytes arrays
Browse files Browse the repository at this point in the history
bpf.ksym() now returns a bytes array, and python3 would issue TypeError
when matching the string.

Signed-off-by: Gary Lin <[email protected]>
  • Loading branch information
lcp committed Apr 2, 2018
1 parent 76bec4d commit c5b5b30
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/cachetop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c5b5b30

Please sign in to comment.