[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 12/14] simpletrace: added simplified Analyzer2 class
From: |
Mads Ynddal |
Subject: |
Re: [PATCH v4 12/14] simpletrace: added simplified Analyzer2 class |
Date: |
Tue, 26 Sep 2023 12:40:22 +0200 |
>> + class Formatter2(Analyzer2):
>
> Was this class part of the benchmark? It appears to be unused.
>
>> + def __init__(self):
>> + self.last_timestamp_ns = None
>> +
>> + def catchall(self, *rec_args, event, timestamp_ns, pid, event_id):
>> + if self.last_timestamp_ns is None:
>> + self.last_timestamp_ns = timestamp_ns
>> + delta_ns = timestamp_ns - self.last_timestamp_ns
>> + self.last_timestamp_ns = timestamp_ns
>> +
>> + fields = [
>> + f'{name}={r}' if is_string(type) else f'{name}=0x{r:x}'
>> + for r, (type, name) in zip(rec_args, event.args)
>> + ]
>> + print(f'{event.name} {delta_ns / 1000:0.3f} {pid=} ' + '
>> '.join(fields))
>> +
>> try:
>> run(Formatter())
>> except SimpleException as e:
It was indeed, but was left in as a usage example. I have decided to keep
Formatter2 in favor of Formatter, as Formatter is based on the Analyzer class
that this patchset is deprecating.