Skip to content

Commit

Permalink
toplev: Fix some type issues with newer MYPY
Browse files Browse the repository at this point in the history
  • Loading branch information
Andi Kleen committed Aug 30, 2024
1 parent 9394a6f commit 8d5c7fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tl_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def __init__(self, logfile, sep, args, version, cpu):
self.args = args
self.printed_headers = set()

def print_header(self, timestamp, title):
def print_header_csv(self, timestamp, title):
if self.no_header:
return
if self.curname_nologf not in self.printed_headers:
Expand All @@ -440,7 +440,7 @@ def print_header(self, timestamp, title):
self.printed_headers.add(self.curname_nologf)

def show(self, timestamp, title, area, hdr, val, unit, desc, sample, bn, below, idle):
self.print_header(timestamp, title)
self.print_header_csv(timestamp, title)
if self.args.no_desc:
desc = ""
desc = re.sub(r"\s+", " ", desc)
Expand Down
4 changes: 3 additions & 1 deletion toplev.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,9 +1070,11 @@ def gen_cpu_name(cpu):
cpu = "spr"
for j in known_cpus:
if cpu == j[0]:
if isinstance(j[1][0], tuple):
if len(j[1]) > 0 and isinstance(j[1][0], tuple):
return "GenuineIntel-6-%02X-%d" % j[1][0]
else:
if len(j[1]) == 0:
sys.exit("Cannot generate cpu name for %s" % cpu)
if j[1][0] in eventlist_alias:
return eventlist_alias[j[1][0]] # type: ignore
return "GenuineIntel-6-%02X" % j[1][0] # type: ignore
Expand Down

0 comments on commit 8d5c7fd

Please sign in to comment.