| 18 | |
| 19 | |
| 20 | class ProfilingItem(BaseModel): |
| 21 | scope: ProfilingScope |
| 22 | count: int = 0 |
| 23 | times: List[float] = [] |
| 24 | start_timestamps: List[datetime] = [] |
| 25 | |
| 26 | def avg(self) -> float: |
| 27 | return np.average(self.times) # type: ignore |
| 28 | |
| 29 | def std(self) -> float: |
| 30 | return np.std(self.times) # type: ignore |
| 31 | |
| 32 | def mean(self) -> float: |
| 33 | return np.mean(self.times) # type: ignore |
| 34 | |
| 35 | def percentile(self, perc: float) -> float: |
| 36 | return np.percentile(self.times, perc) # type: ignore |
| 37 | |
| 38 | |
| 39 | class TimeRecorder: |