Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
ttop handles more files now (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsds143 authored May 19, 2021
1 parent 29c30e0 commit f2b6ae5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pysper/ttop.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TTopParser:
)
# [001900] user= 4.87% sys= 5.52% alloc= 2172kb/s - RMI TCP Connection(184)-127.0.0.1
tinfo_match = re.compile(
r" *\[(?P<thread_id>[0-9]+)\] user= *(?P<user_cpu>-?[0-9]+\.[0-9]+)% sys= *(?P<sys_cpu>-?[0-9]+\.[0-9]+)% alloc= *(?P<heap_rate>[0-9]+)(?P<heap_unit>[m|k]?b)/s - (?P<thread_name>.+)"
r" *\[(?P<thread_id>[0-9]+)\] user=\s*(?P<user_cpu>-?[0-9]+\.[0-9]+)% sys=\s*(?P<sys_cpu>-?[0-9]+\.[0-9]+)% alloc=\s*(?P<heap_rate>-?[0-9]+)(?P<heap_unit>(mb|kb|b|gb))/s - (?P<thread_name>.*)"
)

def __init__(self, start=None, end=None):
Expand Down Expand Up @@ -127,6 +127,7 @@ def parse(self, log):
else:
m = self.tinfo_match.match(line)
if not m:

raise ValueError("thread info not found in '" + line + "'")
threads[m.group("thread_name")]["user_cpu"] = float(
m.group("user_cpu")
Expand Down Expand Up @@ -165,6 +166,7 @@ def collate_threads(self, threads):
exprs = []
exprs.append(r":.*")
exprs.append(r"-\d+.*")
exprs.append(r"- \d+.*")
exprs.append(r"-\/.*")
for thread in threads:
name = thread
Expand Down

0 comments on commit f2b6ae5

Please sign in to comment.