diff --git a/pysper/ttop.py b/pysper/ttop.py index fd65be6..66fc932 100644 --- a/pysper/ttop.py +++ b/pysper/ttop.py @@ -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[0-9]+)\] user= *(?P-?[0-9]+\.[0-9]+)% sys= *(?P-?[0-9]+\.[0-9]+)% alloc= *(?P[0-9]+)(?P[m|k]?b)/s - (?P.+)" + r" *\[(?P[0-9]+)\] user=\s*(?P-?[0-9]+\.[0-9]+)% sys=\s*(?P-?[0-9]+\.[0-9]+)% alloc=\s*(?P-?[0-9]+)(?P(mb|kb|b|gb))/s - (?P.*)" ) def __init__(self, start=None, end=None): @@ -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") @@ -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