mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-30 14:04:27 +00:00
Add start_timestamps to ProfilingItem
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
parent
ddf7fd12c4
commit
682c2b44c4
@ -1,4 +1,5 @@
|
|||||||
import time
|
import time
|
||||||
|
from datetime import datetime
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import TYPE_CHECKING, List
|
from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ class ProfilingItem(BaseModel):
|
|||||||
scope: ProfilingScope
|
scope: ProfilingScope
|
||||||
count: int = 0
|
count: int = 0
|
||||||
times: List[float] = []
|
times: List[float] = []
|
||||||
|
start_timestamps: List[datetime] = []
|
||||||
|
|
||||||
def avg(self) -> float:
|
def avg(self) -> float:
|
||||||
return np.average(self.times) # type: ignore
|
return np.average(self.times) # type: ignore
|
||||||
@ -50,6 +52,7 @@ class TimeRecorder:
|
|||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
if settings.debug.profile_pipeline_timings:
|
if settings.debug.profile_pipeline_timings:
|
||||||
self.start = time.monotonic()
|
self.start = time.monotonic()
|
||||||
|
self.conv_res.timings[self.key].start_timestamps.append(datetime.utcnow())
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
|
Loading…
Reference in New Issue
Block a user